Mercurial > touhou
comparison pytouhou/game/enemy.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 | 364935f6e313 |
comparison
equal
deleted
inserted
replaced
151:5cf927cbd9c5 | 152:86807b8a63bd |
---|---|
65 self.speed = 0. | 65 self.speed = 0. |
66 self.rotation_speed = 0. | 66 self.rotation_speed = 0. |
67 self.acceleration = 0. | 67 self.acceleration = 0. |
68 | 68 |
69 self.hitbox = (0, 0) | 69 self.hitbox = (0, 0) |
70 self.hitbox_half_size = (0, 0) | |
70 self.screen_box = None | 71 self.screen_box = None |
71 | 72 |
72 self.pop_enemy = pop_enemy | 73 self.pop_enemy = pop_enemy |
73 | 74 |
74 | 75 |
140 | 141 |
141 def set_anim(self, index): | 142 def set_anim(self, index): |
142 self._sprite = Sprite() | 143 self._sprite = Sprite() |
143 self._anmrunner = ANMRunner(self._anm_wrapper, index, self._sprite) | 144 self._anmrunner = ANMRunner(self._anm_wrapper, index, self._sprite) |
144 self._anmrunner.run_frame() | 145 self._anmrunner.run_frame() |
146 | |
147 | |
148 def collide(self, player): | |
149 if self.touchable: | |
150 #TODO: animation | |
151 #TODO: doesn’t always kill herself (a boss for example), search how | |
152 self._removed = True | |
153 player.die() | |
145 | 154 |
146 | 155 |
147 def set_pos(self, x, y, z): | 156 def set_pos(self, x, y, z): |
148 self.x, self.y = x, y | 157 self.x, self.y = x, y |
149 self.interpolator = Interpolator((x, y)) | 158 self.interpolator = Interpolator((x, y)) |