comparison pytouhou/game/enemy.pyx @ 486:2f53be1b2f60

Merge netplay branch.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 27 Sep 2013 19:01:47 +0200
parents pytouhou/game/enemy.py@1de67f332f00 pytouhou/game/enemy.py@06f0eeb519bb
children 887de1309491
comparison
equal deleted inserted replaced
474:ca22df9e70bc 486:2f53be1b2f60
211 211
212 212
213 cpdef Player select_player(self, list players=None): 213 cpdef Player select_player(self, list players=None):
214 if players is None: 214 if players is None:
215 players = self._game.players 215 players = self._game.players
216 return players[0] #TODO 216 return min(players, key=self.select_player_key)
217 217
218 218
219 cpdef double get_player_angle(self, tuple pos=None, Player player=None): 219 cpdef double get_player_angle(self, tuple pos=None, Player player=None):
220 cdef double x, y 220 cdef double x, y
221 if player is None: 221 if player is None:
538 538
539 self.handle_callbacks() 539 self.handle_callbacks()
540 540
541 self.frame += 1 541 self.frame += 1
542 542
543
544 def select_player_key(self, p):
545 return ((p.x - self.x) ** 2 + (p.y - self.y) ** 2, p.state.character)