Skip to content

Commit

Permalink
Fixes rates for sliding so things can slide down and to the left.
Browse files Browse the repository at this point in the history
  • Loading branch information
erodozer committed Jun 6, 2011
1 parent 4a8771f commit 7b3732e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Rockmeter.py
Expand Up @@ -466,12 +466,16 @@ def __init__(self, layer, section):
#how long it takes for the transition to take place
self.transitionTime = self.get("transitionTime", float, 512.0)

self.rates = [0,0]
self.updateRates()

def updateRates(self):
t = self.transitionTime * (max(self.engine.clock.get_fps(), _minFPS)) / 1000.0
self.rates = [(self.endCoord[0] - self.startCoord[0])/t,
(self.endCoord[1] - self.startCoord[1])/t]
for i in range(2):
if self.endCoord[i] < self.startCoord[i]:
self.rates[i] = (self.startCoord[i] - self.endCoord[i])/t
else:
self.rates[i] = (self.endCoord[i] - self.startCoord[i])/t
if isinstance(self.layer, FontLayer):
self.rates[0] *= -1
self.rates[1] *= -1
Expand Down Expand Up @@ -510,7 +514,7 @@ def update(self):
else:
self.position = self.startCoord[:]

self.layer.position = [self.position[0], self.position[1]]
self.layer.position = self.position[:]

#fades the color of the layer between this color and its original
#in a set period of time when the condition is met
Expand Down

0 comments on commit 7b3732e

Please sign in to comment.