summaryrefslogtreecommitdiff
path: root/starling/node-2d.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2020-12-15 20:02:31 -0500
committerDavid Thompson <dthompson@vistahigherlearning.com>2020-12-15 20:02:31 -0500
commitc70443c83a5a337d082fc58e0067a5f14cfae805 (patch)
treefdcc5fb028ae1002dc3fa64f8cb6fd7a8a853f00 /starling/node-2d.scm
parentb4de83ce32e382dd85cad0cc5bb697dd691e2dde (diff)
Use a more precise timer.
Diffstat (limited to 'starling/node-2d.scm')
-rw-r--r--starling/node-2d.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/starling/node-2d.scm b/starling/node-2d.scm
index 6d83da2..f7a40df 100644
--- a/starling/node-2d.scm
+++ b/starling/node-2d.scm
@@ -39,6 +39,7 @@
#:use-module (chickadee scripting)
#:use-module (ice-9 match)
#:use-module (oop goops)
+ #:use-module (rnrs base)
#:use-module (starling asset)
#:use-module (starling node)
#:use-module (starling scene)
@@ -499,8 +500,9 @@
(frame-duration (frame-duration anim))
(frames (frames anim))
(anim-duration (* frame-duration (vector-length frames)))
- (time (modulo (- (elapsed-time) (start-time sprite)) anim-duration))
- (frame (vector-ref frames (floor (/ time frame-duration)))))
+ (time (mod (- (elapsed-time) (start-time sprite)) anim-duration))
+ (frame (vector-ref frames (inexact->exact
+ (floor (/ time frame-duration))))))
(set! (index sprite) frame)
(next-method)))