aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2026-04-12 23:00:17 +0100
committerGene Pasquet <dev@etenil.net>2026-04-12 23:00:17 +0100
commite29143f891ea0f25480c9e2b2c5b765f0b343bff (patch)
tree9411ae4be8f3d7523d89ba2d6327d0e4c9f189fe
parent893d1b17ef63b7e2e9d4f6c9dd70c07b61c7bc59 (diff)
Fix animation test, simplify a let* to a let
-rw-r--r--animation.scm8
-rw-r--r--tests/animation-test.scm7
2 files changed, 8 insertions, 7 deletions
diff --git a/animation.scm b/animation.scm
index c8f4497..e3e6e89 100644
--- a/animation.scm
+++ b/animation.scm
@@ -53,10 +53,10 @@
;; Entities without #:anim-name are returned unchanged.
(define (advance-animation entity anim)
- (let* ((tick (+ 1 (entity-ref entity #:anim-tick 0)))
- (duration (animation-duration anim))
- (frames (animation-frames anim))
- (frame (entity-ref entity #:anim-frame 0)))
+ (let ((tick (+ 1 (entity-ref entity #:anim-tick 0)))
+ (duration (animation-duration anim))
+ (frames (animation-frames anim))
+ (frame (entity-ref entity #:anim-frame 0)))
(if (>= tick duration)
(let ((new-frame-id (modulo (+ frame 1) (length frames))))
(entity-set-many entity
diff --git a/tests/animation-test.scm b/tests/animation-test.scm
index 9a71dec..87b18e7 100644
--- a/tests/animation-test.scm
+++ b/tests/animation-test.scm
@@ -20,7 +20,8 @@
(test-group "frame->duration"
(test-equal "first frame, frames (0)" 100 (frame->duration '((0 100)) 0))
(test-equal "wraps around" 100 (frame->duration '((0 100) (1 200)) 2))
- (test-equal "frame 1 of (27 28)" 200 (frame->duration '((27 100) (28 200)) 1)))
+ (test-equal "frame 1 of (27 28)" 200 (frame->duration '((27 100) (28 200)) 1))
+)
(test-group "set-animation"
(let ((entity (list #:type 'player #:anim-name 'idle #:anim-frame 5 #:anim-tick 8)))
@@ -57,10 +58,10 @@
(test-group "animated entity"
(let* ((anims '((#:name walk #:frames (2 3) #:duration 4)))
(entity (list #:type 'player #:anim-name 'walk #:anim-frame 0 #:anim-tick 0 #:animations anims))
- (stepped-entity (apply-animation entity #f 10)))
+ (stepped-entity (apply-animation #f entity 10)))
(test-equal "Updated animated entity" 1 (entity-ref stepped-entity #:anim-tick)))
(let* ((entity (list #:type 'static))
- (stepped-entity (apply-animation entity #f 10)))
+ (stepped-entity (apply-animation #f entity 10)))
(test-equal "unchanged static entity" #f (entity-ref stepped-entity #:anim-tick)))))
(test-end "animation")