From ab74313ac96b5259f17555085f1fdb9780cd387c Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 27 Jul 2008 16:28:37 +0000 Subject: Target the nearest monster on joystick button 3 Should be made configurable later (Mantis 151) --- src/game.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index 0773b8e7..37375ca2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -810,12 +810,11 @@ 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]) + // Target the nearest player + if (keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER)) { - Being *target = - beingManager->findNearestLivingBeing(player_node, 20, Being::PLAYER); + Being *target = beingManager->findNearestLivingBeing( + player_node, 20, Being::PLAYER); if (target) { @@ -823,9 +822,9 @@ void Game::handleInput() } } - // Target the nearest monster if 'a' pressed - if ( keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ) - //if (keys[SDLK_a]) + // Target the nearest monster + if (keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) + || (joystick && joystick->buttonPressed(3))) { Being *target = beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER); -- cgit v1.2.3-70-g09d2