From 9dd811b55587aeb76344b835006cb4a01601bb5d Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 23 Mar 2008 01:27:13 +0000 Subject: Merged revisions 3823,3825-3826,3829,3831-3839,3841-3842 via svnmerge from https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0 ........ r3823 | crush_tmw | 2007-12-28 19:36:58 +0100 (Fri, 28 Dec 2007) | 1 line Added the possibility to assign particle effects to monsters in the monster database. Added flame particle effect to fire goblin as a proof of concept. ........ r3826 | crush_tmw | 2007-12-30 01:02:14 +0100 (Sun, 30 Dec 2007) | 1 line Added a key for targeting the nearest player character based on patches by Trinexx. Some mapping fixes at snake dungeon map. ........ r3839 | the_enemy | 2008-01-13 17:28:50 +0100 (Sun, 13 Jan 2008) | 1 line Fixed non-default location music loading ........ r3842 | crush_tmw | 2008-01-14 11:48:13 +0100 (Mon, 14 Jan 2008) | 1 line ixed an error in Davids last commit (couldn't compile that way). ........ --- src/game.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index e07a70bd..985b7ddc 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -767,9 +767,20 @@ void Game::handleInput() player_node->setWalkingDir(direction); + // Target the nearest player if 'q' is pressed + if (keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER)) + { + 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]) + if (keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST)) { Being *target = beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER); -- cgit v1.2.3-70-g09d2