diff options
Diffstat (limited to 'game.scm')
-rw-r--r-- | game.scm | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -462,6 +462,7 @@ ;; Scrolling level: (define *scroll* 0.0) + (define *last-scroll* 0.0) (define *scroll-speed* 0.5) (define *last-row-scanned* 0) ;; action id, sprite sheet offset, x, y @@ -545,6 +546,7 @@ (match level (#('level height foreground background collision objects) (let ((scroll (min (+ *scroll* *scroll-speed*) max-scroll))) + (set! *last-scroll* *scroll*) (set! *scroll* scroll) (let ((row (max (- (trunc (/ (- (* height tile-height) @@ -620,7 +622,7 @@ (match enemy (#('enemy _ _ position size stationary? velocity _) (if stationary? - (set-vec2-y! position (+ (vec2-y position) *scroll-speed*)) + (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)))))))) @@ -925,6 +927,7 @@ (set! *game-state* 'play) (scheduler-reset! *scheduler*) (set! *scroll* 0.0) + (set! *last-scroll* 0.0) (set! *last-row-scanned* (level-height level)) (bullet-pool-reset! player-bullets) (bullet-pool-reset! enemy-bullets) |