Movement relative to framerate

Blitz3D Forums/Blitz3D Programming/Movement relative to framerate

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi,

Originally I programmed my game to run at 40 fps. Then I decided I did not want this limit (mainly because my own computer couldn't run it that fast) and just let it run as fast as possible but then make all the movement relative to the current framerate. This was fairly simple, I have a variable like this :

unit=Float(frameDuration)/25.0

(frameduration is the difference between the last time and this time in milliseconds).

Then if I would want to move a character 0.5 unit every 40 frames, I just move it 0.5*unit. If the game runs at only 20fps, this would move it by 1 each frame, if the game runs at 80fps this will move it by 0.25 - so that's correct.

The only problem is when jumping. Basically my jumping works like this (simplified) :

If you press jump :
player\dy#=0.55

Every frame :
player\dy#=player\dy#-0.05

MoveEntity player\entity,0,player\dy#,0

Now my question is, how do I modify this so it also uses my unit variable, and that the player still jumps equally fast and equally high no matter what the framerate is (just more or less smoothly)? I just can't seem to get my head around this...

Thanks.