From 13f3e9eb3581e71138df19f63896c71c6c3c334c Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 27 Oct 2023 08:50:05 -0400 Subject: Remove unused background from map. --- Makefile | 2 +- compile-map.scm | 1 - game.scm | 15 +++++---------- level.tmx | 44 -------------------------------------------- 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 @@ - - -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,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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