summaryrefslogtreecommitdiff
path: root/game.scm
diff options
context:
space:
mode:
Diffstat (limited to 'game.scm')
-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