aboutsummaryrefslogtreecommitdiff
path: root/animation.scm
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2026-04-18 02:47:10 +0100
committerGene Pasquet <dev@etenil.net>2026-04-18 02:47:10 +0100
commit38eee24832fe6da4f135cae455881ab97953b23a (patch)
treecffc2bb3b45ac11d90f4a2de3e207f65862fb6fd /animation.scm
parenta02b892e2ad1e1605ff942c63afdd618daa48be4 (diff)
Refresh docs and re-indent
Diffstat (limited to 'animation.scm')
-rw-r--r--animation.scm28
1 files changed, 13 insertions, 15 deletions
diff --git a/animation.scm b/animation.scm
index 8843512..b7fe9c7 100644
--- a/animation.scm
+++ b/animation.scm
@@ -1,8 +1,7 @@
(module downstroke-animation *
(import scheme
(chicken base)
- (chicken pretty-print)
- (only srfi-1 filter)
+ (only srfi-1 filter)
downstroke-entity
downstroke-world)
@@ -28,14 +27,14 @@
(define (frame->tile-id frames frame-idx)
(let ((frame-def (frame-by-idx frames frame-idx)))
(if (list? frame-def)
- (car frame-def)
- frame-def)))
+ (car frame-def)
+ frame-def)))
(define (frame->duration frames frame-idx)
(let ((frame-def (frame-by-idx frames frame-idx)))
(if (list? frame-def)
- (cadr frame-def)
- 10)))
+ (cadr frame-def)
+ 10)))
;; ---- set-animation ----
;; Switch to a new animation, resetting frame and tick counters.
@@ -54,8 +53,8 @@
(filter (lambda (anim) (eq? (animation-ref anim #:name) name))
animations)))
(if (pair? matching-anims)
- (car matching-anims)
- #f)))
+ (car matching-anims)
+ #f)))
;; ---- animate-entity ----
;; Advance the animation tick/frame counter for one game tick.
@@ -70,13 +69,13 @@
(if (>= tick duration)
(let ((new-frame-id (modulo (+ frame 1) (length frames))))
(entity-set-many entity
- `((#:anim-tick . 0)
- (#:anim-frame . ,new-frame-id)
- (#:tile-id . ,(frame->tile-id frames new-frame-id))
- (#:duration . ,(frame->duration frames new-frame-id)))))
+ `((#:anim-tick . 0)
+ (#:anim-frame . ,new-frame-id)
+ (#:tile-id . ,(frame->tile-id frames new-frame-id))
+ (#:duration . ,(frame->duration frames new-frame-id)))))
(entity-set-many entity
- `((#:anim-tick . ,tick)
- (#:tile-id . ,(frame->tile-id frames frame)))))))
+ `((#:anim-tick . ,tick)
+ (#:tile-id . ,(frame->tile-id frames frame)))))))
(define (animate-entity entity animations)
(let* ((anim-name (entity-ref entity #:anim-name #f))
@@ -88,7 +87,6 @@
(define-pipeline (apply-animation animation) (scene entity dt)
guard: (entity-ref entity #:animations #f)
(let ((animations (entity-ref entity #:animations #f)))
- (pp entity)
(animate-entity entity animations)))
) ;; End of animation module