Dont compare floats using equal (chances are good you'll "miss" your value due to missing precision).

I'd do something like this (pseudo code):

`float dx = 0, dy = 0;`

...

if(key_left)

dx = max(dx - ax * frametime, -maxdx); // accelerate

else if(key_right)

dx = min(dx + ax * frametime, maxdx); // deaccelerate

else

dx *= pow(0.9, frametime); // slow down

if(key_jump && !falling && ! jumping)

dy = -djump; // jump

else

dy = min(dy + gravity * frametime, maxdy); // fall

sprite.Move(dx * frametime, dy * frametime)

To make sure you don't forget your time scaling, just think of the real value representations. A velocity is "distance/time", so you have to scale it once. A acceleration is "distance/(time*time)" so you have to scale the value twice in the end. Or in other words: Input some made up values with real si units, then see if you get some distance only - not a time or velocity