Wait, nevermind... Something odd is going on on my side. Time to reboot I guess, sorry for the false alarm.
Edit: pretty good. There's something about the animation that makes the movement speed seems like it's varying, though. Not sure what causes it, maybe his back moving like it does.
As for jumping, something like this works decently (very much pseudo code):
yspeed = 0;
gravity = 1; //Change this to whatever gravity value works well.
while (gameloop)
{
yspeed += gravity;
player_y += yspeed; //You can divide yspeed or lower gravity to alter jump speeds.
if (pressing jump key)
yspeed = -some_value; //You can tweak this value to alter jump height.
if (touching floor)
yspeed = 0;
}
Sorry for not having checked your .c file yet, if it's obvious.
Also, the above system is VERY simple, not taking into account for pixel-perfect collision detection. You need a bit more for that (and to avoid your character getting stuck in the floor), but I'm sure you can figure it out from here. :)
EDIT: just checked the code... It's a pretty big mess of if conditions I see. You can at least make the engine itself a bit more efficient by using "else if"s where appropriate.
Example:
if (x < 0) "something";
else if (x == 0) "something else";
else "something when x > 0";
Why is this more efficient? Well, if the first if ran, we already know that all other related conditions WILL be false (if x < 0 we know it can't be 0 or higher). Thus the engine doesn't actually NEED to check these extra conditions, and an else if / else in the code WILL actually skip them for you. That's less checking and code execution per frame. ;)
Edited by DaVince on 2010/4/28 15:19:05
Edited by DaVince on 2010/4/28 15:24:15