Make the arrow keys work too.

This commit is contained in:
Zed A. Shaw 2024-04-27 00:04:50 -04:00
parent 38c0fee65c
commit 084a9c59a6

View file

@ -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: