comparison pytouhou/game/item.py @ 152:86807b8a63bd

Add collisions with enemies and items.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 09 Oct 2011 15:32:43 -0700
parents 5cf927cbd9c5
children 37df8c618c2e
comparison
equal deleted inserted replaced
151:5cf927cbd9c5 152:86807b8a63bd
36 self.delta = dx, dy 36 self.delta = dx, dy
37 37
38 self._sprite.angle = angle 38 self._sprite.angle = angle
39 39
40 40
41 def collect(self, player):
42 player.state.score += self._item_type.score
43 self._removed = True
44
45
41 def update(self): 46 def update(self):
42 dx, dy = self.delta 47 dx, dy = self.delta
43 48
44 if self.player is not None: 49 if self.player is not None:
45 self.angle = atan2(self.player.y - self.y, self.player.x - self.x) 50 self.angle = atan2(self.player.y - self.y, self.player.x - self.x)