comparison pytouhou/game/game.py @ 430:c9433188ffdb

Remove AnmWrapper, since ANMs are lists of entries now.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 03 Aug 2013 15:49:04 +0200
parents f41a26971a19
children b0abb05811f7
comparison
equal deleted inserted replaced
429:40d5f3083ebc 430:c9433188ffdb
103 self.difficulty = self.difficulty_max 103 self.difficulty = self.difficulty_max
104 104
105 105
106 def enable_spellcard_effect(self): 106 def enable_spellcard_effect(self):
107 self.spellcard_effect = Effect((-32., -16.), 0, 107 self.spellcard_effect = Effect((-32., -16.), 0,
108 self.spellcard_effect_anm_wrapper) #TODO: find why this offset is necessary. 108 self.spellcard_effect_anm) #TODO: find why this offset is necessary.
109 self.spellcard_effect.sprite.allow_dest_offset = True #TODO: should be the role of anm’s 25th instruction. Investigate! 109 self.spellcard_effect.sprite.allow_dest_offset = True #TODO: should be the role of anm’s 25th instruction. Investigate!
110 110
111 111
112 def disable_spellcard_effect(self): 112 def disable_spellcard_effect(self):
113 self.spellcard_effect = None 113 self.spellcard_effect = None
172 #TODO: check 172 #TODO: check
173 enemy.process.switch_to_sub(enemy.death_callback) 173 enemy.process.switch_to_sub(enemy.death_callback)
174 enemy.death_callback = -1 174 enemy.death_callback = -1
175 175
176 176
177 def new_effect(self, pos, anim, anm_wrapper=None, number=1): 177 def new_effect(self, pos, anim, anm=None, number=1):
178 number = min(number, self.nb_bullets_max - len(self.effects)) 178 number = min(number, self.nb_bullets_max - len(self.effects))
179 for i in xrange(number): 179 for i in xrange(number):
180 self.effects.append(Effect(pos, anim, anm_wrapper or self.etama)) 180 self.effects.append(Effect(pos, anim, anm or self.etama[1]))
181 181
182 182
183 def new_particle(self, pos, anim, amp, number=1, reverse=False, duration=24): 183 def new_particle(self, pos, anim, amp, number=1, reverse=False, duration=24):
184 number = min(number, self.nb_bullets_max - len(self.effects)) 184 number = min(number, self.nb_bullets_max - len(self.effects))
185 for i in xrange(number): 185 for i in xrange(number):
186 self.effects.append(Particle(pos, anim, self.etama, amp, self, reverse=reverse, duration=duration)) 186 self.effects.append(Particle(pos, anim, self.etama[1], amp, self, reverse=reverse, duration=duration))
187 187
188 188
189 def new_enemy(self, pos, life, instr_type, bonus_dropped, die_score): 189 def new_enemy(self, pos, life, instr_type, bonus_dropped, die_score):
190 enemy = Enemy(pos, life, instr_type, bonus_dropped, die_score, self.enm_anm_wrapper, self) 190 enemy = Enemy(pos, life, instr_type, bonus_dropped, die_score, self.enm_anm, self)
191 self.enemies.append(enemy) 191 self.enemies.append(enemy)
192 return enemy 192 return enemy
193 193
194 194
195 def new_msg(self, sub): 195 def new_msg(self, sub):
196 self.msg_runner = MSGRunner(self.msg, sub, self) 196 self.msg_runner = MSGRunner(self.msg, sub, self)
197 self.msg_runner.run_iteration() 197 self.msg_runner.run_iteration()
198 198
199 199
200 def new_label(self, pos, text): 200 def new_label(self, pos, text):
201 label = Text(pos, self.interface.ascii_wrapper, text=text, xspacing=8, shift=48) 201 label = Text(pos, self.interface.ascii_anm, text=text, xspacing=8, shift=48)
202 label.set_timeout(60, effect='move') 202 label.set_timeout(60, effect='move')
203 self.labels.append(label) 203 self.labels.append(label)
204 return label 204 return label
205 205
206 206
207 def new_hint(self, hint): 207 def new_hint(self, hint):
208 pos = hint['Pos'] 208 pos = hint['Pos']
209 #TODO: Scale 209 #TODO: Scale
210 210
211 pos = pos[0] + 192, pos[1] 211 pos = pos[0] + 192, pos[1]
212 label = Text(pos, self.interface.ascii_wrapper, text=hint['Text'], align=hint['Align']) 212 label = Text(pos, self.interface.ascii_anm, text=hint['Text'], align=hint['Align'])
213 label.set_timeout(hint['Time']) 213 label.set_timeout(hint['Time'])
214 label.set_alpha(hint['Alpha']) 214 label.set_alpha(hint['Alpha'])
215 label.set_color(hint['Color'], text=False) 215 label.set_color(hint['Color'], text=False)
216 self.labels.append(label) 216 self.labels.append(label)
217 return label 217 return label
218 218
219 219
220 def new_face(self, side, effect): 220 def new_face(self, side, effect):
221 face = Face(self.msg_anm_wrapper, effect, side) 221 face = Face(self.msg_anm, effect, side)
222 self.faces[side] = face 222 self.faces[side] = face
223 return face 223 return face
224 224
225 225
226 def run_iter(self, keystate): 226 def run_iter(self, keystate):