summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--compile-map.scm1
-rw-r--r--game.scm15
-rw-r--r--level.tmx44
4 files changed, 6 insertions, 56 deletions
diff --git a/Makefile b/Makefile
index 6a91bd5..a71f0fb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
game.wasm: game.scm level.scm
/gnu/store/i7qi9wsyhxzv3w4y992qgx5j9g5dcza0-profile/bin/guile -L $(HOME)/Code/guile-hoot/module game.scm
-level.scm: level.tmx
+level.scm: level.tmx compile-map.scm
guile compile-map.scm > level.scm
bundle:
diff --git a/compile-map.scm b/compile-map.scm
index 11b8d9e..1270fc4 100644
--- a/compile-map.scm
+++ b/compile-map.scm
@@ -560,6 +560,5 @@ the default ORIENTATION value of 'orthogonal' is supported."
`(make-level
,(tile-map-height tile-map)
,(compile-tile-layer (tile-map-layer-ref tile-map "foreground"))
- ,(compile-tile-layer (tile-map-layer-ref tile-map "background"))
,(compile-collision-layer (tile-map-layer-ref tile-map "collision"))
,(compile-object-layer (tile-map-layer-ref tile-map "objects"))))
diff --git a/game.scm b/game.scm
index b4ee027..33db2df 100644
--- a/game.scm
+++ b/game.scm
@@ -601,7 +601,6 @@
level?
(height level-height set-level-height!)
(foreground level-foreground set-level-foreground!)
- (background level-background set-level-background!)
(collision level-collision set-level-collision!)
(objects level-objects set-level-objects!))
(define level ,(call-with-input-file "level.scm" read))
@@ -609,7 +608,7 @@
(+ (* level-width y) x))
(define (point-collides-with-level? level x y)
(match level
- (#('level height foreground background collision objects)
+ (#('level height foreground collision objects)
(let ((tx (trunc (/ x tile-width)))
(ty (trunc (/ y tile-height))))
(and (>= tx 0) (< tx level-width)
@@ -617,7 +616,7 @@
(= (bytevector-u8-ref collision (level-offset tx ty)) 1))))))
(define (rect-collides-with-level? level x y w h)
(match level
- (#('level height foreground background collision objects)
+ (#('level height foreground collision objects)
(let* ((y (+ y (- (* height tile-height) game-height *scroll*)))
(tx0 (trunc (/ x tile-width)))
(ty0 (trunc (/ y tile-height)))
@@ -633,7 +632,7 @@
(occupied? tx0 ty1))))))
(define (draw-level-layer level layer parallax)
(match level
- (#('level height _ _ _ _)
+ (#('level height _ _ _)
(let* ((tw tile-width)
(th tile-height)
(scroll (* *scroll* parallax))
@@ -656,16 +655,12 @@
tx (- ty pixel-y-offset) tw th)))))))))
(define (draw-level-foreground level)
(match level
- (#('level height foreground background collision objects)
+ (#('level height foreground collision objects)
(draw-level-layer level foreground 1.0))))
- (define (draw-level-background level)
- (match level
- (#('level height foreground background collision objects)
- (draw-level-layer level background 0.75))))
(define max-scroll (- (* (level-height level) tile-height) game-height))
(define (level-update! level)
(match level
- (#('level height foreground background collision objects)
+ (#('level height foreground collision objects)
(let ((scroll (min (+ *scroll* *scroll-speed*) max-scroll)))
(set! *last-scroll* *scroll*)
(set! *scroll* scroll)
diff --git a/level.tmx b/level.tmx
index 63618f5..8c376b1 100644
--- a/level.tmx
+++ b/level.tmx
@@ -1,50 +1,6 @@
<?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="14">
<tileset firstgid="1" source="tiles.tsx"/>
- <layer id="2" name="background" width="15" height="40" visible="0">
- <data encoding="csv">
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-7,7,7,7,7,7,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