From: Tobias Gläßer Date: Sun, 29 Feb 2004 21:59:17 +0000 (+0000) Subject: fixed bug which caused tux to "swing" on low frame rates X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=246f3981ea5e6dc3044cfb20c4d06be2787feb49;p=supertux.git fixed bug which caused tux to "swing" on low frame rates SVN-Revision: 161 --- diff --git a/src/gameloop.c b/src/gameloop.c index 5c6f4c925..199546c45 100644 --- a/src/gameloop.c +++ b/src/gameloop.c @@ -686,7 +686,7 @@ int gameloop(char * subset, int levelnb, int mode) } if(tux.input.down == DOWN) - SDL_Delay(30); + SDL_Delay(45); /*Draw the current scene to the screen */ /*If the machine running the game is too slow diff --git a/src/player.c b/src/player.c index 44d583055..9423b1035 100644 --- a/src/player.c +++ b/src/player.c @@ -882,9 +882,17 @@ void player_input(player_type *pplayer) else { if(pplayer->base.xm > 0) - pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio); + { + pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio); + if(pplayer->base.xm < 0) + pplayer->base.xm = 0; + } else if(pplayer->base.xm < 0) - pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio); + { + pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio); + if(pplayer->base.xm > 0) + pplayer->base.xm = 0; + } } /* Jump/jumping? */