diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-10-28 09:37:35 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-10-28 09:37:35 -0400 |
commit | 0bbf9bae9275b403efb4994ef84baf0d35e1d9cf (patch) | |
tree | afcb5168facbc8fca66ec75ce1cad2b5207f8656 | |
parent | ceeaae033fd119d8f7ab2bc1f8e61147cd229495 (diff) |
Add scroll dy to non-stationary enemies, too.
-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 |