Sinusoidal Movement Script

Another script thingy that I made around February. It is a script that allows objects to move in a sinusoidal pattern to make animating simple movements a little easier. Sorry if the explanations are hard to understand.

Code

var timer = 0

onEvent(‘update’, function () {
timer += 1 / 30
this.y = Math.sin(timer * 200) * 10
});

Tutorial:

Another Demo:
shipinwatertest2-21-2024_13-33-01.wick (34.6 KB)

Also, when you’re using the script in an object, you have to put the object inside of another object and put the code in the nested object. It won’t work properly if you don’t do this.

1 Like