Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(HScreen::getScreen()->GetInput().IsKeyDown(sf::Key::Left))
- {
- for(int i=0; i<16; i++)
- {
- if(!isCollidingAt(x-WALK_SPEED, y-i, OBJ_MASK))
- {
- x -= WALK_SPEED;
- y -= i;
- break;
- }
- }
- }
- if(HScreen::getScreen()->GetInput().IsKeyDown(sf::Key::Right))
- {
- for(int i=0; i<16; i++)
- {
- if(!isCollidingAt(x+WALK_SPEED, y-i, OBJ_MASK))
- {
- x += WALK_SPEED;
- y -= i;
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment