comparison pytouhou/vm/eclrunner.py @ 304:f3099ebf4f61

Update attribute names to reflect the actual interface.
author Thibaut Girka <thib@sitedethib.com>
date Tue, 13 Mar 2012 18:38:14 +0100
parents 34ea45d95489
children 52d791bb7c32
comparison
equal deleted inserted replaced
303:647bde10353d 304:f3099ebf4f61
162 death_flags = enm.death_flags & 7 162 death_flags = enm.death_flags & 7
163 163
164 enm.die_anim() 164 enm.die_anim()
165 165
166 if death_flags < 4: 166 if death_flags < 4:
167 if enm._bonus_dropped > -1: 167 if enm.bonus_dropped > -1:
168 enm.drop_particles(7, 0) 168 enm.drop_particles(7, 0)
169 self._game.drop_bonus(enm.x, enm.y, enm._bonus_dropped) 169 self._game.drop_bonus(enm.x, enm.y, enm.bonus_dropped)
170 elif enm._bonus_dropped == -1: 170 elif enm.bonus_dropped == -1:
171 if self._game.deaths_count % 3 == 0: 171 if self._game.deaths_count % 3 == 0:
172 enm.drop_particles(10, 0) 172 enm.drop_particles(10, 0)
173 self._game.drop_bonus(enm.x, enm.y, self._game.bonus_list[self._game.next_bonus]) 173 self._game.drop_bonus(enm.x, enm.y, self._game.bonus_list[self._game.next_bonus])
174 self._game.next_bonus = (self._game.next_bonus + 1) % 32 174 self._game.next_bonus = (self._game.next_bonus + 1) % 32
175 else: 175 else:
177 self._game.deaths_count += 1 177 self._game.deaths_count += 1
178 else: 178 else:
179 enm.drop_particles(4, 0) 179 enm.drop_particles(4, 0)
180 180
181 if death_flags == 0: 181 if death_flags == 0:
182 enm._removed = True 182 enm.removed = True
183 return 183 return
184 184
185 if death_flags == 1: 185 if death_flags == 1:
186 enm.touchable = False 186 enm.touchable = False
187 elif death_flags == 2: 187 elif death_flags == 2:
212 else: 212 else:
213 raise Exception('What the hell, man!') 213 raise Exception('What the hell, man!')
214 214
215 def run_iteration(self): 215 def run_iteration(self):
216 # First, if enemy is dead, return 216 # First, if enemy is dead, return
217 if self._enemy._removed: 217 if self._enemy.removed:
218 return False 218 return False
219 219
220 # Then, check for callbacks 220 # Then, check for callbacks
221 self.handle_callbacks() 221 self.handle_callbacks()
222 222
307 307
308 308
309 @instruction(1) 309 @instruction(1)
310 def destroy(self, arg): 310 def destroy(self, arg):
311 #TODO: arg? 311 #TODO: arg?
312 self._enemy._removed = True 312 self._enemy.removed = True
313 313
314 314
315 @instruction(2) 315 @instruction(2)
316 def relative_jump(self, frame, instruction_pointer): 316 def relative_jump(self, frame, instruction_pointer):
317 """Jumps to a relative offset in the same subroutine. 317 """Jumps to a relative offset in the same subroutine.
1101 self._enemy.remaining_lives = lives 1101 self._enemy.remaining_lives = lives
1102 1102
1103 1103
1104 @instruction(128) 1104 @instruction(128)
1105 def interrupt(self, event): 1105 def interrupt(self, event):
1106 self._enemy._anmrunner.interrupt(event) 1106 self._enemy.anmrunner.interrupt(event)
1107 1107
1108 1108
1109 @instruction(129) 1109 @instruction(129)
1110 def interrupt_aux(self, number, event): 1110 def interrupt_aux(self, number, event):
1111 self._enemy.aux_anm[number]._anmrunner.interrupt(event) 1111 self._enemy.aux_anm[number].anmrunner.interrupt(event)
1112 1112
1113 1113
1114 @instruction(132) 1114 @instruction(132)
1115 def set_visible(self, value): 1115 def set_visible(self, value):
1116 self._enemy._visible = not bool(value) 1116 self._enemy.visible = not bool(value)
1117 1117
1118 1118
1119 @instruction(131) 1119 @instruction(131)
1120 def set_difficulty_coeffs(self, speed_a, speed_b, nb_a, nb_b, shots_a, shots_b): 1120 def set_difficulty_coeffs(self, speed_a, speed_b, nb_a, nb_b, shots_a, shots_b):
1121 self._enemy.difficulty_coeffs = (speed_a, speed_b, nb_a, nb_b, shots_a, shots_b) 1121 self._enemy.difficulty_coeffs = (speed_a, speed_b, nb_a, nb_b, shots_a, shots_b)