Browse Source

add getCurrentFrame, used in toontown vine game

Redmond Urbino 19 years ago
parent
commit
f4d998e214
1 changed files with 12 additions and 0 deletions
  1. 12 0
      direct/src/interval/ActorInterval.py

+ 12 - 0
direct/src/interval/ActorInterval.py

@@ -118,6 +118,18 @@ class ActorInterval(Interval.Interval):
         # Initialize superclass
         Interval.Interval.__init__(self, name, duration)
 
+    def getCurrentFrame(self):
+        """Calculate the current frame playing in this interval.
+
+        returns a float value between startFrame and endFrame, inclusive
+        returns None if there are any problems
+        """
+        retval = None
+        if not self.isStopped():
+            framesPlayed = self.numFrames * self.currT
+            retval = self.startFrame + framesPlayed
+        return retval
+
     def privStep(self, t):
         frameCount = t * self.frameRate
         if self.constrainedLoop: