comparison pytouhou/game/game.py @ 173:35d850502d1f

Move effects where they should be.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 21 Oct 2011 09:37:23 -0700
parents ea2ad94c33a0
children 80a4c7ed43b3
comparison
equal deleted inserted replaced
172:ea2ad94c33a0 173:35d850502d1f
18 from pytouhou.vm.eclrunner import ECLMainRunner 18 from pytouhou.vm.eclrunner import ECLMainRunner
19 19
20 from pytouhou.game.player import Player 20 from pytouhou.game.player import Player
21 from pytouhou.game.enemy import Enemy 21 from pytouhou.game.enemy import Enemy
22 from pytouhou.game.item import Item 22 from pytouhou.game.item import Item
23 from pytouhou.game.effect import Effect
23 24
24 25
25 26
26 class Game(object): 27 class Game(object):
27 def __init__(self, resource_loader, player_states, stage, rank, difficulty, 28 def __init__(self, resource_loader, player_states, stage, rank, difficulty,
48 self.prng = Random() 49 self.prng = Random()
49 self.frame = 0 50 self.frame = 0
50 51
51 self.enm_anm_wrapper = resource_loader.get_anm_wrapper2(('stg%denm.anm' % stage, 52 self.enm_anm_wrapper = resource_loader.get_anm_wrapper2(('stg%denm.anm' % stage,
52 'stg%denm2.anm' % stage)) 53 'stg%denm2.anm' % stage))
54 self.eff00 = resource_loader.get_anm_wrapper(('eff00.anm',))
53 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) 55 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage)
54 self.ecl_runner = ECLMainRunner(ecl, self) 56 self.ecl_runner = ECLMainRunner(ecl, self)
55 57
56 58
57 def drop_bonus(self, x, y, _type, end_pos=None): 59 def drop_bonus(self, x, y, _type, end_pos=None):
66 def change_bullets_into_star_items(self): 68 def change_bullets_into_star_items(self):
67 player = self.players[0] #TODO 69 player = self.players[0] #TODO
68 item_type = self.item_types[6] 70 item_type = self.item_types[6]
69 self.items.extend(Item((bullet.x, bullet.y), item_type, self, player=player) for bullet in self.bullets) 71 self.items.extend(Item((bullet.x, bullet.y), item_type, self, player=player) for bullet in self.bullets)
70 self.bullets = [] 72 self.bullets = []
73
74
75 def new_effect(self, pos, anim):
76 self.effects.append(Effect(pos, anim, self.eff00))
71 77
72 78
73 def new_enemy(self, pos, life, instr_type, bonus_dropped, die_score): 79 def new_enemy(self, pos, life, instr_type, bonus_dropped, die_score):
74 enemy = Enemy(pos, life, instr_type, bonus_dropped, die_score, self.enm_anm_wrapper, self) 80 enemy = Enemy(pos, life, instr_type, bonus_dropped, die_score, self.enm_anm_wrapper, self)
75 self.enemies.append(enemy) 81 self.enemies.append(enemy)