From 3213f41daeed034c8aa9b8be9e86796737a38a78 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 2 Sep 2006 12:50:40 +0000 Subject: 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). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/game.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/game.cpp') 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)) -- cgit v1.2.3-70-g09d2