summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game.scm5
-rw-r--r--level.tmx3
2 files changed, 6 insertions, 2 deletions
diff --git a/game.scm b/game.scm
index 23618c2..f3cafdd 100644
--- a/game.scm
+++ b/game.scm
@@ -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)
diff --git a/level.tmx b/level.tmx
index 2191ef4..c16eb72 100644
--- a/level.tmx
+++ b/level.tmx
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<map version="1.8" tiledversion="1.8.6" orientation="orthogonal" renderorder="right-down" width="15" height="40" tilewidth="16" tileheight="16" infinite="0" nextlayerid="6" nextobjectid="13">
+<map version="1.8" tiledversion="1.8.6" orientation="orthogonal" renderorder="right-down" width="15" height="40" tilewidth="16" tileheight="16" infinite="0" nextlayerid="6" nextobjectid="14">
<tileset firstgid="1" source="tiles.tsx"/>
<layer id="2" name="background" width="15" height="40">
<data encoding="csv">
@@ -137,5 +137,6 @@
<object id="10" type="enemy-a" x="16" y="336" width="16" height="16"/>
<object id="11" type="enemy-a" x="192" y="336" width="16" height="16"/>
<object id="12" type="enemy-a" x="112" y="176" width="16" height="16"/>
+ <object id="13" type="enemy-a" x="112" y="0" width="16" height="16"/>
</objectgroup>
</map>