ThatSnail

Untitled

Oct 26th, 2012
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. if(HScreen::getScreen()->GetInput().IsKeyDown(sf::Key::Left))
  2.     {
  3.         for(int i=0; i<16; i++)
  4.         {
  5.             if(!isCollidingAt(x-WALK_SPEED, y-i, OBJ_MASK))
  6.             {
  7.                 x -= WALK_SPEED;
  8.                 y -= i;
  9.                 break;
  10.             }
  11.         }
  12.     }
  13.     if(HScreen::getScreen()->GetInput().IsKeyDown(sf::Key::Right))
  14.     {
  15.         for(int i=0; i<16; i++)
  16.         {
  17.             if(!isCollidingAt(x+WALK_SPEED, y-i, OBJ_MASK))
  18.             {
  19.                 x += WALK_SPEED;
  20.                 y -= i;
  21.                 break;
  22.             }
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment