Make the arrow keys work too.
This commit is contained in:
parent
38c0fee65c
commit
084a9c59a6
1 changed files with 4 additions and 6 deletions
|
@ -126,13 +126,11 @@ int main() {
|
|||
break;
|
||||
case sf::Event::KeyPressed:
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
|
||||
shape.move(-20, 0);
|
||||
b2Vec2 force(-200, 1000);
|
||||
box.body->ApplyForceToCenter(force, true);
|
||||
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
|
||||
shape.move(20, 0);
|
||||
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
|
||||
shape.move(0, -20);
|
||||
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
|
||||
shape.move(0, 20);
|
||||
b2Vec2 force(200, 1000);
|
||||
box.body->ApplyForceToCenter(force, true);
|
||||
}
|
||||
break;
|
||||
case sf::Event::MouseButtonPressed:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue