Skip to content

Commit

Permalink
Slow down the ball a little.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 13, 2005
1 parent af36ffc commit cfd8ad7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions example/mmpong.c
Expand Up @@ -153,7 +153,15 @@ static void update_mice(int screen_w, int screen_h)

static void update_ball(int screen_w, int screen_h)
{
static Uint32 lastupdate = 0;
Uint32 now = SDL_GetTicks();
Ball *ball = &puck;

if (now - lastupdate < 10)
return;

lastupdate += 10;

if(ball->y < 0) ball->dir_h = DOWN;
if(ball->y > screen_h - 10) ball->dir_h = UP;
if(ball->x < 15){
Expand Down

0 comments on commit cfd8ad7

Please sign in to comment.