summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index ed8ad827..7921c388 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -686,6 +686,18 @@ void Game::handleInput()
player_node->attack(target, newTarget);
}
+ // Target the nearest monster if 'a' pressed
+ if (keys[SDLK_a])
+ {
+ Being *target =
+ beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER);
+
+ if (target)
+ {
+ player_node->setTarget(target);
+ }
+ }
+
if (joystick)
{
if (joystick->buttonPressed(1))