summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-02 12:50:40 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-02 12:50:40 +0000
commit3213f41daeed034c8aa9b8be9e86796737a38a78 (patch)
tree5441dd101209774d6e7c6612281b3ef12bd941a5 /src/game.cpp
parentf5fc009543a0a189bcde5acf91ff315dd9cd05e9 (diff)
downloadmana-3213f41daeed034c8aa9b8be9e86796737a38a78.tar.gz
mana-3213f41daeed034c8aa9b8be9e86796737a38a78.tar.bz2
mana-3213f41daeed034c8aa9b8be9e86796737a38a78.tar.xz
mana-3213f41daeed034c8aa9b8be9e86796737a38a78.zip
Applied patch by Bernard Lidicky, adding targetting nearest monster with either
keyboard or mouse. Also made clicking beings in general a bit easier (patch applied by Bjørn Lindeijer).
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))