summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-10-28 09:37:35 -0400
committerDavid Thompson <dthompson2@worcester.edu>2023-10-28 09:37:35 -0400
commit0bbf9bae9275b403efb4994ef84baf0d35e1d9cf (patch)
treeafcb5168facbc8fca66ec75ce1cad2b5207f8656
parentceeaae033fd119d8f7ab2bc1f8e61147cd229495 (diff)
Add scroll dy to non-stationary enemies, too.
-rw-r--r--game.scm12
1 files 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