Mercurial > touhou
comparison pytouhou/game/laser.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 | b11953cf1d3b |
children | 1222341ea22c |
comparison
equal
deleted
inserted
replaced
429:40d5f3083ebc | 430:c9433188ffdb |
---|---|
20 | 20 |
21 STARTING, STARTED, STOPPING = range(3) | 21 STARTING, STARTED, STOPPING = range(3) |
22 | 22 |
23 | 23 |
24 class LaserLaunchAnim(object): | 24 class LaserLaunchAnim(object): |
25 def __init__(self, laser, anm_wrapper, index): | 25 def __init__(self, laser, anm, index): |
26 self._laser = laser | 26 self._laser = laser |
27 self.sprite = Sprite() | 27 self.sprite = Sprite() |
28 self.sprite.anm, self.sprite.texcoords = anm_wrapper.get_sprite(index) | 28 self.sprite.anm = anm |
29 self.sprite.texcoords = anm.sprites[index] | |
29 self.sprite.blendfunc = 1 | 30 self.sprite.blendfunc = 1 |
30 self.removed = False | 31 self.removed = False |
31 self.objects = [self] | 32 self.objects = [self] |
32 self.x, self.y = 0, 0 | 33 self.x, self.y = 0, 0 |
33 | 34 |
55 angle, speed, start_offset, end_offset, max_length, width, | 56 angle, speed, start_offset, end_offset, max_length, width, |
56 start_duration, duration, stop_duration, | 57 start_duration, duration, stop_duration, |
57 grazing_delay, grazing_extra_duration, | 58 grazing_delay, grazing_extra_duration, |
58 game): | 59 game): |
59 self._game = game | 60 self._game = game |
60 launch_anim = LaserLaunchAnim(self, laser_type.anm_wrapper, | 61 launch_anim = LaserLaunchAnim(self, laser_type.anm, |
61 laser_type.launch_anim_offsets[sprite_idx_offset] | 62 laser_type.launch_anim_offsets[sprite_idx_offset] |
62 + laser_type.launch_sprite_idx) | 63 + laser_type.launch_sprite_idx) |
63 self._game.effects.append(launch_anim) | 64 self._game.effects.append(launch_anim) |
64 self._laser_type = laser_type | 65 self._laser_type = laser_type |
65 self.state = STARTING | 66 self.state = STARTING |
95 self.sprite_idx_offset = sprite_idx_offset | 96 self.sprite_idx_offset = sprite_idx_offset |
96 | 97 |
97 lt = self._laser_type | 98 lt = self._laser_type |
98 self.sprite = Sprite() | 99 self.sprite = Sprite() |
99 self.sprite.angle = self.angle | 100 self.sprite.angle = self.angle |
100 self.anmrunner = ANMRunner(lt.anm_wrapper, lt.anim_index, | 101 self.anmrunner = ANMRunner(lt.anm, lt.anim_index, |
101 self.sprite, self.sprite_idx_offset) | 102 self.sprite, self.sprite_idx_offset) |
102 self.anmrunner.run_frame() | 103 self.anmrunner.run_frame() |
103 | 104 |
104 | 105 |
105 def _check_collision(self, point, border_size): | 106 def _check_collision(self, point, border_size): |
232 if sprite_idx_offset is not None: | 233 if sprite_idx_offset is not None: |
233 self.sprite_idx_offset = sprite_idx_offset | 234 self.sprite_idx_offset = sprite_idx_offset |
234 | 235 |
235 lt = self._laser_type | 236 lt = self._laser_type |
236 self.sprite = Sprite() | 237 self.sprite = Sprite() |
237 self.anmrunner = ANMRunner(lt.anm_wrapper, lt.anim_index, | 238 self.anmrunner = ANMRunner(lt.anm, lt.anim_index, |
238 self.sprite, self.sprite_idx_offset) | 239 self.sprite, self.sprite_idx_offset) |
239 #self.sprite.blendfunc = 1 #XXX | 240 #self.sprite.blendfunc = 1 #XXX |
240 self.anmrunner.run_frame() | 241 self.anmrunner.run_frame() |
241 | 242 |
242 | 243 |