aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2025-11-21 05:11:08 +0000
committerGene Pasquet <dev@etenil.net>2025-11-21 05:20:15 +0000
commitb8c88dd712cba2f7cef6b277d7c36b12eb5f154a (patch)
tree27717392353b6a2b4c30ad799cb3d8d1778841bd
parent09113c1f5d9d344f683bdf09ac12a5198ded194e (diff)
render multiple map layers
-rw-r--r--TODO.org16
-rw-r--r--src/game.scm20
2 files changed, 14 insertions, 22 deletions
diff --git a/TODO.org b/TODO.org
index acecb2f..96e24fb 100644
--- a/TODO.org
+++ b/TODO.org
@@ -3,7 +3,7 @@
* Milestone 1: A World That Moves
** Map & Rendering
*** DONE Update map parser to read layer information. :graphics:
-*** TODO Render multiple tile layers (simple implementation). :graphics:
+*** DONE Render multiple tile layers (simple implementation). :graphics:
** Input & Player Basics
*** TODO Build a simple input-state map (keys pressed/held). :input:
@@ -14,11 +14,9 @@
*** TODO Implement a basic `scene` that holds a list of entities. :scene:
*** TODO Write `scene-add-entity!` and `scene-foreach-entity`. :scene:
----
-
* Milestone 2: Seeing & Controlling Things
** Sprite Rendering
-*** TODO Load a texture and draw a static sprite. :graphics:sprites:
+*** DONE Load a texture and draw a static sprite. :graphics:sprites:
*** TODO Add sprite reference to player entity plist. :entities:
** Input → Actions
@@ -28,8 +26,6 @@
** Entity Utilities
*** TODO Write plist helpers for entity data (ref, set!, update!). :entities:plist:
----
-
* Milestone 3: A Moving Camera, Gravity & Scene Loading
** Camera
*** TODO Implement a basic camera struct with x/y. :graphics:camera:
@@ -43,8 +39,6 @@
*** TODO Make a function to load a scene from a tilemap name + prefab list. :scene_management:
*** TODO Add a per-entity :init function for initialization. :entities:
----
-
* Milestone 4: Collisions, Prefabs & Simple Enemies
** Collision
*** TODO AABB overlap function. :physics:collision:
@@ -58,8 +52,6 @@
*** TODO Add simple FSM fields (:state, :next-state) to an enemy entity. :ai:
*** TODO Implement “idle → patrol” logic in enemy update. :ai:
----
-
* Milestone 5: Animated Tiles, Entity Collisions & More Player Feel
** Graphics Polish
*** TODO Add tile animation metadata to tileset. :graphics:animation:
@@ -73,8 +65,6 @@
*** TODO Add :speed and :jump-strength fields to player plist. :entities:
*** TODO Make movement feel nicer by tweaking acceleration/velocity. :physics:
----
-
* Milestone 6: Audio, UI & Better Enemy Logic
** Audio
*** TODO Bind essential SDL2_mixer functions via FFI. :audio:
@@ -89,8 +79,6 @@
*** TODO Implement “patrol direction switch” when hitting tile edges. :ai:
*** TODO Let enemy react to player proximity (simple check). :ai:
----
-
* Milestone 7: Pathfinding, Better Scenes, More Polish
** Pathfinding
*** TODO Implement A* node structure and open/closed sets. :ai:pathfinding:
diff --git a/src/game.scm b/src/game.scm
index 4206533..bdabbf1 100644
--- a/src/game.scm
+++ b/src/game.scm
@@ -71,18 +71,22 @@
(define (draw-tilemap-rows draw-fn rows row-num)
(unless (null? rows)
- (for-each (lambda (tile-id col-num) (draw-fn tile-id row-num col-num))
- (car rows)
- (iota (length (car rows))))
+ (for-each
+ (cut draw-fn <> row-num <>)
+ (car rows)
+ (iota (length (car rows))))
(draw-tilemap-rows draw-fn (cdr rows) (+ row-num 1))))
(define (draw-tilemap renderer tilemap)
- (let ((map-layer (layer-map (car (tilemap-layers tilemap))))
+ (let ((map-layers (tilemap-layers tilemap))
(tileset (tilemap-tileset tilemap)))
- (draw-tilemap-rows
- (lambda (tile-id row-num col-num) (draw-tile renderer tileset tile-id row-num col-num))
- map-layer
- 0)))
+ (for-each
+ (lambda (layer)
+ (draw-tilemap-rows
+ (cut draw-tile renderer tileset <> <> <>)
+ (layer-map layer)
+ 0))
+ map-layers)))
(define (draw-objects renderer tilemap)
(let ((objects (tilemap-objects tilemap))