diff pytouhou/game/enemy.py @ 479:1de67f332f00

Fix several synchro issues
author Thibaut Girka <thib@sitedethib.com>
date Wed, 28 Dec 2011 19:42:48 +0100
parents 0595315d3880
children
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -152,7 +152,7 @@ class Enemy(object):
 
 
     def select_player(self, players=None):
-        return (players or self._game.players)[0] #TODO
+        return min(players or self._game.players, key=lambda p: ((p.x - self.x) ** 2 + (p.y - self.y) ** 2, p.state.character)) #TODO
 
 
     def get_player_angle(self, player=None, pos=None):