comparison pytouhou/game/enemy.py @ 183:b6d7ce644f34

Implement two new ECL instructions.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 26 Oct 2011 02:27:00 -0700
parents 20843875ad8f
children 54eb6b254b7b
comparison
equal deleted inserted replaced
182:20843875ad8f 183:b6d7ce644f34
26 self._game = game 26 self._game = game
27 self._anm_wrapper = anm_wrapper 27 self._anm_wrapper = anm_wrapper
28 self._sprite = None 28 self._sprite = None
29 self._anmrunner = None 29 self._anmrunner = None
30 self._removed = False 30 self._removed = False
31 self._visible = True
31 self._type = _type 32 self._type = _type
32 self._bonus_dropped = bonus_dropped 33 self._bonus_dropped = bonus_dropped
33 self._die_score = die_score #TODO: use it 34 self._die_score = die_score #TODO: use it
34 self._was_visible = False 35 self._was_visible = False
35 36
99 # Apply difficulty-specific modifiers: 100 # Apply difficulty-specific modifiers:
100 value *= 1. - .4 * (self._game.difficulty - 16.) / 32. 101 value *= 1. - .4 * (self._game.difficulty - 16.) / 32.
101 102
102 self.bullet_launch_interval = int(value) 103 self.bullet_launch_interval = int(value)
103 self.bullet_launch_timer = int(value * start) 104 self.bullet_launch_timer = int(value * start)
104 print(self.bullet_launch_interval, self.bullet_launch_timer)
105 105
106 106
107 def fire(self): 107 def fire(self):
108 (type_, type_idx, sprite_idx_offset, bullets_per_shot, number_of_shots, 108 (type_, type_idx, sprite_idx_offset, bullets_per_shot, number_of_shots,
109 speed, speed2, launch_angle, angle, flags) = self.bullet_attributes 109 speed, speed2, launch_angle, angle, flags) = self.bullet_attributes
278 278
279 #TODO 279 #TODO
280 if self._anmrunner and not self._anmrunner.run_frame(): 280 if self._anmrunner and not self._anmrunner.run_frame():
281 self._anmrunner = None 281 self._anmrunner = None
282 282
283 if self._sprite: 283 if self._sprite and self._visible:
284 if self._sprite._removed: 284 if self._sprite._removed:
285 self._sprite = None 285 self._sprite = None
286 else: 286 else:
287 self._sprite.update_orientation(self.angle, 287 self._sprite.update_orientation(self.angle,
288 self.automatic_orientation) 288 self.automatic_orientation)