diff options
-rw-r--r-- | game.scm | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |