if(e.key.keysym.sym == SDLK_d) player.right = true;
if(e.key.keysym.sym == SDLK_a) player.left = true;
if(e.key.keysym.sym == SDLK_SPACE) player.loc.y += 10;
+ if(e.key.keysym.sym == SDLK_i)if(currentWorld->behind) currentWorld=currentWorld->behind;
+ if(e.key.keysym.sym == SDLK_k)if(currentWorld->infront)currentWorld=currentWorld->infront;
break;
case SDL_KEYUP:
if(e.key.keysym.sym == SDLK_d) player.right = false;
break;
}
}
-}
\ No newline at end of file
+}
prevTime = SDL_GetTicks();
}
- player.loc.x += player.vel.x * (deltaTime / 2); //update the player's x based on
+ player.loc.x += player.vel.x*deltaTime; //update the player's x based on
gw=currentWorld->getWidth();
if(player.loc.x+player.width>-1+gw){