comparison 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
comparison
equal deleted inserted replaced
478:884ca91b0854 479:1de67f332f00
150 flags, player, self._game)) 150 flags, player, self._game))
151 bullet_angle += angle 151 bullet_angle += angle
152 152
153 153
154 def select_player(self, players=None): 154 def select_player(self, players=None):
155 return (players or self._game.players)[0] #TODO 155 return min(players or self._game.players, key=lambda p: ((p.x - self.x) ** 2 + (p.y - self.y) ** 2, p.state.character)) #TODO
156 156
157 157
158 def get_player_angle(self, player=None, pos=None): 158 def get_player_angle(self, player=None, pos=None):
159 player = player or self.select_player() 159 player = player or self.select_player()
160 x, y = pos or (self.x, self.y) 160 x, y = pos or (self.x, self.y)