comparison pytouhou/game/effect.py @ 328:56523a16db1d

Fix some replay synchronization issues and update the TODO.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 21 Jun 2012 19:59:41 +0200
parents f3099ebf4f61
children bdcf2077e368
comparison
equal deleted inserted replaced
327:13201d90bb22 328:56523a16db1d
55 self.sprite.rescale = (size, size) 55 self.sprite.rescale = (size, size)
56 56
57 self.pos_interpolator = None 57 self.pos_interpolator = None
58 self.scale_interpolator = None 58 self.scale_interpolator = None
59 self.rotations_interpolator = None 59 self.rotations_interpolator = None
60 self.alpha_interpolator = None
60 61
61 self.amp = amp 62 self.amp = amp
62 63
63 64
64 def set_end_pos(self, amp): 65 def set_end_pos(self, amp):
69 end_pos, 24, formula=(lambda x: 2. * x - x ** 2)) 70 end_pos, 24, formula=(lambda x: 2. * x - x ** 2))
70 self.scale_interpolator = Interpolator(self.sprite.rescale, 0, 71 self.scale_interpolator = Interpolator(self.sprite.rescale, 0,
71 (0., 0.), 24) 72 (0., 0.), 24)
72 self.rotations_interpolator = Interpolator(self.sprite.rotations_3d, 0, 73 self.rotations_interpolator = Interpolator(self.sprite.rotations_3d, 0,
73 (0., 0., 2*pi), 24) 74 (0., 0., 2*pi), 24)
75 self.alpha_interpolator = Interpolator((self.sprite.alpha,), 0,
76 (0.,), 24)
74 77
75 78
76 def update(self): 79 def update(self):
77 if self.frame == 0: 80 if self.frame == 0:
78 self.set_end_pos(self.amp) 81 self.set_end_pos(self.amp)
85 self.sprite.rescale = self.scale_interpolator.values 88 self.sprite.rescale = self.scale_interpolator.values
86 89
87 self.rotations_interpolator.update(self.frame) 90 self.rotations_interpolator.update(self.frame)
88 self.sprite.rotations_3d = self.rotations_interpolator.values 91 self.sprite.rotations_3d = self.rotations_interpolator.values
89 92
93 self.alpha_interpolator.update(self.frame)
94 self.sprite.alpha, = self.alpha_interpolator.values
95
90 self.sprite.changed = True 96 self.sprite.changed = True
91 97
92 if self.frame == 24: 98 if self.frame == 24:
93 self.removed = True 99 self.removed = True
94 100