comparison pytouhou/game/enemymanager.py @ 42:1b0ca2fb89f9

Refactor ECL parsing/etc.
author Thibaut Girka <thib@sitedethib.com>
date Thu, 18 Aug 2011 22:11:39 +0200
parents ce662b372ee0
children 25ca15f714ad
comparison
equal deleted inserted replaced
41:93c8dc2de923 42:1b0ca2fb89f9
37 self.acceleration = 0. 37 self.acceleration = 0.
38 38
39 self.hitbox = (0, 0) 39 self.hitbox = (0, 0)
40 40
41 self.ecl_runner.implementation.update({#67: ('HHIIffffI', self.set_bullet_attributes), 41 self.ecl_runner.implementation.update({#67: ('HHIIffffI', self.set_bullet_attributes),
42 97: ('I', self.set_sprite), 42 97: (self.set_sprite),
43 98: ('HHHHHH', self.set_multiple_sprites), 43 98: (self.set_multiple_sprites),
44 45: ('ff', self.set_angle_speed), 44 45: (self.set_angle_speed),
45 43: ('fff', self.set_pos), 45 43: (self.set_pos),
46 46: ('f', self.set_rotation_speed), 46 46: (self.set_rotation_speed),
47 47: ('f', self.set_speed), 47 47: (self.set_speed),
48 48: ('f', self.set_acceleration), 48 48: (self.set_acceleration),
49 51: ('If', self.target_player), 49 51: (self.target_player),
50 57: ('Ifff', self.move_to), 50 57: (self.move_to),
51 100: ('I', self.set_death_sprite), 51 100: (self.set_death_sprite),
52 103: ('fff', self.set_hitbox)}) #TODO 52 103: (self.set_hitbox)}) #TODO
53 53
54 54
55 55
56 def set_death_sprite(self, sprite_index): 56 def set_death_sprite(self, sprite_index):
57 self.death_sprite = sprite_index % 256 #TODO 57 self.death_sprite = sprite_index % 256 #TODO
219 y = random.rand_double() * 416 #102h.exe@0x41184b 219 y = random.rand_double() * 416 #102h.exe@0x41184b
220 if z < -990: 220 if z < -990:
221 y = random.rand_double() * 800 #102h.exe@0x411881 221 y = random.rand_double() * 800 #102h.exe@0x411881
222 ecl_runner = ECLRunner(self.ecl, sub) 222 ecl_runner = ECLRunner(self.ecl, sub)
223 enemy = Enemy((x, y), life, instr_type, ecl_runner, self.anm_wrapper) 223 enemy = Enemy((x, y), life, instr_type, ecl_runner, self.anm_wrapper)
224 ecl_runner.implementation[1] = ('I', self.make_enemy_deleter(enemy)) 224 ecl_runner.implementation[1] = self.make_enemy_deleter(enemy)
225 225
226 self.enemies.append(enemy) 226 self.enemies.append(enemy)
227 227
228 # Update enemies 228 # Update enemies
229 visible_enemies = [enemy for enemy in self.enemies if enemy.update(frame)] 229 visible_enemies = [enemy for enemy in self.enemies if enemy.update(frame)]