Mercurial > touhou
changeset 598:a7286a0facf9
Add a sample game.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 25 Oct 2014 18:52:17 +0200 |
parents | 244c99c568c8 |
children | d471b07ce4fd |
files | pytouhou/games/sample/game.py |
diffstat | 1 files changed, 1 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
copy from pytouhou/games/eosd/game.py copy to pytouhou/games/sample/game.py --- a/pytouhou/games/eosd/game.py +++ b/pytouhou/games/sample/game.py @@ -139,16 +139,6 @@ class Game(GameBase): common.height, prng, common.interface, hints, friendly_fire) - try: - self.texts['stage_name'] = common.interface.stage_name - except AttributeError: - pass - - try: - self.texts['song_name'] = common.interface.song_name - except AttributeError: - pass - class Player(PlayerBase): @@ -164,47 +154,18 @@ class Player(PlayerBase): self.orbs[0].offset_x = -24 self.orbs[1].offset_x = 24 - self.orb_dx_interpolator = None - self.orb_dy_interpolator = None - - def start_focusing(self): - self.orb_dx_interpolator = Interpolator((24,), self._game.frame, - (8,), self._game.frame + 8, - lambda x: x ** 2) - self.orb_dy_interpolator = Interpolator((0,), self._game.frame, - (-32,), self._game.frame + 8) self.focused = True - def stop_focusing(self): - self.orb_dx_interpolator = Interpolator((8,), self._game.frame, - (24,), self._game.frame + 8, - lambda x: x ** 2) - self.orb_dy_interpolator = Interpolator((-32,), self._game.frame, - (0,), self._game.frame + 8) self.focused = False - @property def objects(self): - return [self] + (self.orbs if self.power >= 8 else []) - + return [self] + self.orbs def update(self, keystate): PlayerBase.update(self, keystate) - if self.death_time == 0 or self._game.frame - self.death_time > 60: - if self.orb_dx_interpolator: - self.orb_dx_interpolator.update(self._game.frame) - dx, = self.orb_dx_interpolator.values - self.orbs[0].offset_x = -dx - self.orbs[1].offset_x = dx - if self.orb_dy_interpolator: - self.orb_dy_interpolator.update(self._game.frame) - dy, = self.orb_dy_interpolator.values - self.orbs[0].offset_y = dy - self.orbs[1].offset_y = dy - for orb in self.orbs: orb.update()