summaryrefslogtreecommitdiff
path: root/utils.scm
diff options
context:
space:
mode:
Diffstat (limited to 'utils.scm')
-rw-r--r--utils.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/utils.scm b/utils.scm
index 5533cc0..df93b26 100644
--- a/utils.scm
+++ b/utils.scm
@@ -118,12 +118,14 @@ given MAX-WIDTH. Return a list of lines."
(vec2+ offset (position sprite))
#:tint (tint sprite)))
-(define (update-animated-sprite sprite dt)
+(define (update-animated-sprite sprite)
(let* ((anim (assq-ref (animations sprite) (current-animation sprite)))
(frame-duration (frame-duration sprite))
(anim-duration (* frame-duration (vector-length anim)))
- (time (modulo (- (agenda-time) (start-time sprite)) anim-duration))
- (frame (vector-ref anim (floor (/ time frame-duration))))
+ (time (floor-remainder (- (agenda-time) (start-time sprite))
+ anim-duration))
+ (frame (vector-ref anim (inexact->exact
+ (floor (/ time frame-duration)))))
(texture-region (texture-atlas-ref (asset-ref (atlas sprite)) frame)))
(set! (texture sprite) texture-region)))