From 0bbf9bae9275b403efb4994ef84baf0d35e1d9cf Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 28 Oct 2023 09:37:35 -0400 Subject: Add scroll dy to non-stationary enemies, too. --- game.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/game.scm b/game.scm index a82136f..04c0a65 100644 --- a/game.scm +++ b/game.scm @@ -781,11 +781,13 @@ (define (enemy-update! enemy) (match enemy (#('enemy _ _ position size stationary? velocity _ _ _ _ _ _) - (if stationary? - (set-vec2-y! position (+ (vec2-y position) (- *scroll* *last-scroll*))) - (begin - (set-vec2-x! position (+ (vec2-x position) (vec2-x velocity))) - (set-vec2-y! position (+ (vec2-y position) (vec2-y velocity)))))))) + (let ((scroll-dy (- *scroll* *last-scroll*))) + (if stationary? + (set-vec2-y! position (+ (vec2-y position) scroll-dy)) + (begin + (set-vec2-x! position (+ (vec2-x position) (vec2-x velocity))) + (set-vec2-y! position (+ (vec2-y position) + (+ (vec2-y velocity) scroll-dy))))))))) (define (draw-enemy enemy time) (let ((frame-duration 250.0)) (match enemy -- cgit v1.2.3