Add start of tiled map compilation for levels.
This commit is contained in:
parent
ebd57bae3a
commit
3a3f4e31a1
12 changed files with 664 additions and 15 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue