comparison pytouhou/games/eosd.py @ 404:6c0cb3eee33e

Add MoF’s hints support, and fix the Text timeout interface.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 24 Mar 2013 10:29:37 +0100
parents b11953cf1d3b
children 608468be7a93
comparison
equal deleted inserted replaced
403:9589a01e6edf 404:6c0cb3eee33e
28 28
29 29
30 class EoSDGame(Game): 30 class EoSDGame(Game):
31 def __init__(self, resource_loader, player_states, stage, rank, difficulty, 31 def __init__(self, resource_loader, player_states, stage, rank, difficulty,
32 bullet_types=None, laser_types=None, item_types=None, 32 bullet_types=None, laser_types=None, item_types=None,
33 nb_bullets_max=640, width=384, height=448, prng=None, continues=0): 33 nb_bullets_max=640, width=384, height=448, prng=None,
34 continues=0, hints=None):
34 35
35 if not bullet_types: 36 if not bullet_types:
36 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',)) 37 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',))
37 etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) 38 etama4 = resource_loader.get_anm_wrapper(('etama4.anm',))
38 bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=2, 39 bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=2,
94 self.stage = stage #XXX 95 self.stage = stage #XXX
95 interface = EoSDInterface(self, resource_loader) 96 interface = EoSDInterface(self, resource_loader)
96 97
97 Game.__init__(self, resource_loader, players, stage, rank, difficulty, 98 Game.__init__(self, resource_loader, players, stage, rank, difficulty,
98 bullet_types, laser_types, item_types, nb_bullets_max, 99 bullet_types, laser_types, item_types, nb_bullets_max,
99 width, height, prng, interface, continues) 100 width, height, prng, interface, continues, hints)
100 101
101 102
102 103
103 class EoSDInterface(object): 104 class EoSDInterface(object):
104 def __init__(self, game, resource_loader): 105 def __init__(self, game, resource_loader):
119 [Effect((0, 0), i, front) for i in range(5) + range(9, 16)]) 120 [Effect((0, 0), i, front) for i in range(5) + range(9, 16)])
120 for item in self.items: 121 for item in self.items:
121 item.sprite.allow_dest_offset = True #XXX 122 item.sprite.allow_dest_offset = True #XXX
122 123
123 self.level_start = [Text((176, 200), ascii_wrapper, text='STAGE %d' % game.stage)] #TODO: find the exact location. 124 self.level_start = [Text((176, 200), ascii_wrapper, text='STAGE %d' % game.stage)] #TODO: find the exact location.
124 self.level_start[0].set_timeout(240, effect=60, start=120) 125 self.level_start[0].set_timeout(240, effect='fadeout', duration=60, start=120)
125 self.level_start[0].set_color('yellow') 126 self.level_start[0].set_color('yellow')
126 #TODO: use the system text for the stage name, and the song name. 127 #TODO: use the system text for the stage name, and the song name.
127 128
128 self.labels = { 129 self.labels = {
129 'highscore': Text((500, 58), ascii_wrapper, front, text='0'), 130 'highscore': Text((500, 58), ascii_wrapper, front, text='0'),