motion; reset interval

This commit is contained in:
Frank DeMarco 2015-02-25 17:33:24 -05:00
parent 0a09d9e8e8
commit 334cb21762
3 changed files with 11 additions and 0 deletions

View File

@ -130,6 +130,9 @@ class Account:
index = 0
self.interval_index = index
def reset_interval(self):
self.interval_index = 0
def reset_timer(self):
if self.animation.unfiltered:
ticks = self.time_filter.get_unfiltered_ticks()

View File

@ -360,6 +360,7 @@ class Frameset:
def reset(self):
self.current_index = 0
self.sprite.accounts[self.sprite.shift_frame].reset_interval()
def get_current_id(self):
return self.order[self.current_index]

7
pgfw/motion.py Normal file
View File

@ -0,0 +1,7 @@
from math import sin, cos, atan2
def get_step(start, end, speed):
x0, y0 = start
x1, y1 = end
angle = atan2(x1 - x0, y1 - y0)
return speed * sin(angle), speed * cos(angle)