Add start of tiled map compilation for levels.

This commit is contained in:
David Thompson 2024-05-19 17:30:36 -04:00
parent ebd57bae3a
commit 3a3f4e31a1
12 changed files with 664 additions and 15 deletions

View file

@ -29,7 +29,7 @@
(('set-wire-state type)
(bcom (^wall bcom type)))
(('describe) `(wall ,type))
(('collide) 'stop)))
(('collide) 'bump)))
(define (^block bcom type)
(match-lambda*
@ -42,7 +42,7 @@
(('set-wire-state type)
(bcom (^block bcom type)))
(('describe) `(block ,type))
(('collide) 'displace)))
(('collide) 'push)))
(define (^clock-emitter bcom interval)
(define timer (spawn ^cell 0))
@ -59,7 +59,7 @@
'copper))))
(('set-wire-state type) #f)
(('describe) '(clock-emitter))
(('collide) 'stop)))
(('collide) 'bump)))
(define (^player bcom)
(match-lambda*
@ -106,9 +106,9 @@
($ player-coords (vector x y)))
(occupant
(match ($ occupant 'collide)
('stop #f)
('bump 'bump)
('goal (pk 'GOAL))
('displace
('push
(let ((next-cell (grid-ref grid (wrap-x (+ x dx)) (wrap-y (+ y dy)))))
(match ($ next-cell)
(#f
@ -116,7 +116,7 @@
($ cell player)
($ old-cell #f)
($ player-coords (vector x y))
'displace)
'push)
(_ #f)))))))))))
(define (warp-player x y)
($ (grid-ref grid x y) player)
@ -182,7 +182,7 @@
($ (grid-ref grid 4 3) (spawn ^clock-emitter 3))
($ (grid-ref grid 5 3) (spawn ^wall 'copper))
($ (grid-ref grid 6 4) (spawn ^block 'copper))
($ (grid-ref grid 6 5) (spawn ^block 'copper))
($ (grid-ref grid 7 3) (spawn ^wall 'copper))
($ (grid-ref grid 8 3) (spawn ^wall 'copper))
($ (grid-ref grid 9 3) (spawn ^wall 'copper))

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.8" tiledversion="1.8.6" orientation="orthogonal" renderorder="right-down" width="20" height="15" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="1">
<tileset firstgid="1" source="tiles.tsx"/>
<layer id="1" name="background" width="20" height="15">
<data encoding="csv">
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24
</data>
</layer>
</map>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.8" tiledversion="1.8.6" name="tiles" tilewidth="16" tileheight="16" tilecount="300" columns="20">
<image source="../../../assets/images/cirkoban.png" width="320" height="240"/>
</tileset>