summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index b3fa6f07..52d70bc0 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -770,6 +770,19 @@ void Game::handleInput()
player_node->attack(target, newTarget);
}
+ // Target the nearest player if 'q' is pressed
+ if ( keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) )
+ //if (keys[SDLK_q])
+ {
+ Being *target =
+ beingManager->findNearestLivingBeing(player_node, 20, Being::PLAYER);
+
+ if (target)
+ {
+ player_node->setTarget(target);
+ }
+ }
+
// Target the nearest monster if 'a' pressed
if ( keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) )
//if (keys[SDLK_a])