comparison pytouhou/vm/anmrunner.py @ 170:e7902309305c

Implement move anm instructions.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 20 Oct 2011 03:15:55 -0700
parents 284ac8f97a96
children 741860192b56
comparison
equal deleted inserted replaced
169:c4b4f7c068f2 170:e7902309305c
174 def load_random_sprite(self, min_idx, amp): 174 def load_random_sprite(self, min_idx, amp):
175 #TODO: use the game's PRNG? 175 #TODO: use the game's PRNG?
176 self.load_sprite(min_idx + randrange(amp)) 176 self.load_sprite(min_idx + randrange(amp))
177 177
178 178
179 @instruction(17)
180 def move(self, x, y, z):
181 self._sprite.dest_offset = (x, y, z)
182
183
184 @instruction(18)
185 def move_in_linear(self, x, y, z, duration):
186 self._sprite.move_in(duration, x, y, z, lambda x: x)
187
188
179 @instruction(19) 189 @instruction(19)
180 def move_in(self, x, y, z, duration): 190 def move_in_decel(self, x, y, z, duration):
181 self._sprite.move_in(duration, x, y, z, lambda x: x) #TODO: formula 191 self._sprite.move_in(duration, x, y, z, lambda x: 2. * x - x ** 2)
192
193
194 @instruction(20)
195 def move_in_accel(self, x, y, z, duration):
196 self._sprite.move_in(duration, x, y, z, lambda x: x ** 2)
182 197
183 198
184 @instruction(23) 199 @instruction(23)
185 def set_corner_relative_placement(self): 200 def set_corner_relative_placement(self):
186 self._sprite.corner_relative_placement = True #TODO 201 self._sprite.corner_relative_placement = True #TODO