comparison pytouhou/games/sample/game.py @ 599:d471b07ce4fd

Add a sample Python ECL.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 25 Oct 2014 18:52:21 +0200
parents a7286a0facf9
children 2a748aa29c3f
comparison
equal deleted inserted replaced
598:a7286a0facf9 599:d471b07ce4fd
20 from pytouhou.game.itemtype import ItemType 20 from pytouhou.game.itemtype import ItemType
21 from pytouhou.game.player import Player as PlayerBase 21 from pytouhou.game.player import Player as PlayerBase
22 from pytouhou.game.orb import Orb 22 from pytouhou.game.orb import Orb
23 from pytouhou.game.background import Background 23 from pytouhou.game.background import Background
24 24
25 from pytouhou.vm import ECLMainRunner 25 from pytouhou.vm import PythonMainRunner
26 from . import enemies
26 27
27 28
28 class Common(object): 29 class Common(object):
29 def __init__(self, resource_loader, player_characters, continues, stage, 30 def __init__(self, resource_loader, player_characters, continues, stage,
30 width=384, height=448): 31 width=384, height=448):
105 try: 106 try:
106 self.enm_anm = resource_loader.get_multi_anm(('stg%denm.anm' % stage, 107 self.enm_anm = resource_loader.get_multi_anm(('stg%denm.anm' % stage,
107 'stg%denm2.anm' % stage)) 108 'stg%denm2.anm' % stage))
108 except KeyError: 109 except KeyError:
109 self.enm_anm = resource_loader.get_anm('stg%denm.anm' % stage) 110 self.enm_anm = resource_loader.get_anm('stg%denm.anm' % stage)
110 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) 111
111 self.ecl_runners = [ECLMainRunner(main, ecl.subs, self) for main in ecl.mains] 112 self.ecl_runners = [PythonMainRunner(getattr(enemies, 'stage%d' % stage), self)]
112 113
113 self.spellcard_effect_anm = resource_loader.get_single_anm('eff0%d.anm' % stage) 114 self.spellcard_effect_anm = resource_loader.get_single_anm('eff0%d.anm' % stage)
114 115
115 self.msg = resource_loader.get_msg('msg%d.dat' % stage) 116 self.msg = resource_loader.get_msg('msg%d.dat' % stage)
116 msg_anm = [common.player_anms[common.first_character][1], #TODO: does it break bomb face of non-first player? 117 msg_anm = [common.player_anms[common.first_character][1], #TODO: does it break bomb face of non-first player?