Mercurial > touhou
comparison pytouhou/game/item.py @ 445:b0abb05811f7
Make pytouhou.game.player an extension type, and move the GameOver exception there since it makes more sense.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 17 Aug 2013 04:44:28 +0200 |
parents | b9d2db93972f |
children |
comparison
equal
deleted
inserted
replaced
444:f26c8ab57257 | 445:b0abb05811f7 |
---|---|
166 if self.frame == 60: | 166 if self.frame == 60: |
167 self.speed_interpolator = Interpolator((0.,), 60, | 167 self.speed_interpolator = Interpolator((0.,), 60, |
168 (3.,), 180) | 168 (3.,), 180) |
169 | 169 |
170 if self.player is not None: | 170 if self.player is not None: |
171 self.angle = atan2(self.player.y - self.y, self.player.x - self.x) | 171 player_state = self.player.state |
172 self.angle = atan2(player_state.y - self.y, player_state.x - self.x) | |
172 self.x += cos(self.angle) * self.speed | 173 self.x += cos(self.angle) * self.speed |
173 self.y += sin(self.angle) * self.speed | 174 self.y += sin(self.angle) * self.speed |
174 elif self.speed_interpolator is None: | 175 elif self.speed_interpolator is None: |
175 self.pos_interpolator.update(self.frame) | 176 self.pos_interpolator.update(self.frame) |
176 self.x, self.y = self.pos_interpolator.values | 177 self.x, self.y = self.pos_interpolator.values |