A game can run at different speeds on different PC's. To adjust for this, you can use 'delta time'. This is a number, generated for each frame, that you can multiply against values to speed up or slow down changes.

For example if a game is running at twice the normal speed, then delta time will be 0.5. Multiplying this against all movement will half the movement speed, compensating for the fact that the game is updating twice as often.

speed = 2.5
x = 0
onEachFrame() do
    fill( :black )
    x = ( x + speed*getDelta() ) % getScreenWidth()
    fillCircle( x, 100, 50, 50, true )

Delta time can also be retrieved using 'onEachFrame', and this function will return exactly the same value.

See also