comparison pytouhou/game/enemymanager.py @ 75:b3bd421bb895

Handle a few more ECL instructions
author Thibaut Girka <thib@sitedethib.com>
date Tue, 30 Aug 2011 16:30:40 +0200
parents e4af16a019d3
children ffe2c2b9912c
comparison
equal deleted inserted replaced
74:adac26098408 75:b3bd421bb895
49 self.low_life_trigger = None 49 self.low_life_trigger = None
50 self.timeout = None 50 self.timeout = None
51 self.timeout_callback = None 51 self.timeout_callback = None
52 self.remaining_lives = -1 52 self.remaining_lives = -1
53 53
54 self.automatic_orientation = False
55
54 self.bullet_launch_interval = 0 56 self.bullet_launch_interval = 0
55 self.delay_attack = False 57 self.delay_attack = False
56 58
57 self.death_anim = None 59 self.death_anim = None
58 self.movement_dependant_sprites = None 60 self.movement_dependant_sprites = None
106 if not self.interpolator: 108 if not self.interpolator:
107 self.interpolator = Interpolator((self.x, self.y), formula) 109 self.interpolator = Interpolator((self.x, self.y), formula)
108 self.interpolator.set_interpolation_start(self.frame, (self.x, self.y)) 110 self.interpolator.set_interpolation_start(self.frame, (self.x, self.y))
109 self.interpolator.set_interpolation_end(self.frame + duration - 1, (x, y)) 111 self.interpolator.set_interpolation_end(self.frame + duration - 1, (x, y))
110 112
111 113 self.speed = 0.
112 def stop_in(self, duration): 114 self.angle = atan2(y - self.y, x - self.x)
113 #TODO: interpolation method and start/stop frame 115
114 # See 97 vs 98 anim conflict 116
117 def stop_in(self, duration, formula):
115 if not self.speed_interpolator: 118 if not self.speed_interpolator:
116 self.speed_interpolator = Interpolator((self.speed,)) 119 self.speed_interpolator = Interpolator((self.speed,), formula)
117 self.speed_interpolator.set_interpolation_start(self.frame, (self.speed,)) 120 self.speed_interpolator.set_interpolation_start(self.frame, (self.speed,))
118 self.speed_interpolator.set_interpolation_end(self.frame + duration, (0.,)) 121 self.speed_interpolator.set_interpolation_end(self.frame + duration, (0.,))
122
123 self.speed = 0.
119 124
120 125
121 def is_visible(self, screen_width, screen_height): 126 def is_visible(self, screen_width, screen_height):
122 if self._sprite: 127 if self._sprite:
123 tx, ty, tw, th = self._sprite.texcoords 128 tx, ty, tw, th = self._sprite.texcoords
209 if self._sprite: 214 if self._sprite:
210 if self._sprite._removed: 215 if self._sprite._removed:
211 self._sprite = None 216 self._sprite = None
212 else: 217 else:
213 self._sprite.update() 218 self._sprite.update()
214 if self._sprite._changed: 219 if self._sprite._changed or self.automatic_orientation:
215 self._sprite.update_vertices_uvs_colors() 220 angle_base = self.angle if self.automatic_orientation else 0.
221 self._sprite.update_vertices_uvs_colors(angle_base=angle_base)
216 222
217 self.frame += 1 223 self.frame += 1
218 224
219 225
220 226