Add physical gates and finish floor switches.

This commit is contained in:
David Thompson 2024-05-21 17:28:57 -04:00
parent ba7b9ea9d8
commit 4c12ccc559
5 changed files with 157 additions and 49 deletions

View file

@ -37,12 +37,18 @@
(5 (spawn ^block x y 'copper))
(6 (spawn ^block x y 'crate))
(7 (spawn ^clock-emitter x y 4))
(8 (spawn ^floor-switch x y))
(8 (let ((target-x (bytevector-u8-ref objects (+ i 3)))
(target-y (bytevector-u8-ref objects (+ i 4))))
(spawn ^floor-switch x y target-x target-y)))
(9 (and spawn-gem? (spawn ^gem x y)))
(id (error "invalid level object" id)))))
(10 (spawn ^gate x y))
(id (error "invalid level object" id))))
(i* (+ i (match id
(8 5) ; floor-switch
(_ 3)))))
(when obj
($ level* 'add-object obj))
(if (= id 3) ; player-spawn
(lp (+ i 3) obj)
(lp (+ i 3) player)))
(lp i* obj)
(lp i* player)))
(%make-level background level* player)))))