Consistent movement regardless of FPS?

How do I make sure movement is consistent across all frame rates?
for reference I have a FPS counter already setup
movement is a simple forever loop with the turn and speed being variables which change to mimic acceleration an deceleration.

https://snap.berkeley.edu/snap/snap.html#present:Username=zoomerjoey&ProjectName=topDownRace%20Beta%20v1

Just do

[scratchblocks]
set [speed v] to (((1) \/ (FPS)::operators) \x (100)::operators)
[/scratchblocks]

Adjust the last number to slow down or speed up to whatever you want. I just put 100 here.

you need to calculate the time since last frame and multiply it by the movements, and can you link the project?

https://snap.berkeley.edu/snap/snap.html#present:Username=zoomerjoey&ProjectName=topDownRace%20Beta%20v1

this is the project (i will also add the build to the original post)
movement is in player main Script, then player location update

I made a block that could help you.

https://snap.berkeley.edu/snap/snap.html#present:Username=joecooldoo&ProjectName=Custom%20Blocks%202

Scroll down to the sensing section and find the [scratchblocks] (speed () × ()::sensing) [/scratchblocks] block.

i will try that but sadly all i have access to at the moment is an Ipad which i can not export blocks from

Just go to the pallette and find it, hold down on the block (Don't move your finger!), and click "Export..."

just tap the file menu, then click export blocks, then tap ok. You might get prompted with where to save the files to. idk, since I haven't tried.

I dont really get the speed block, it says more lag the lower the number and has unecessary waits, juist have a deltatime counter, and multiply it by the speed, as in this project: My cool movment thing
Feel free to use :slight_smile:

Link doesn't work properly
(Working now)

try again? i shared it sorry

Wrong post. The "unnecessary waits" is to calculate the lag.

right but it slows down the game and it should sincease with lag not decrease, so a fps script in stage and use the delta time makes more sense

Except if you want to export the block

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.