Implement interval logic for emitters

This commit is contained in:
Juliana Sims 2024-05-23 16:28:53 -04:00
parent 65076c40f3
commit 13aa8606a9
6 changed files with 65 additions and 30 deletions

View file

@ -66,7 +66,8 @@
(4 (spawn ^exit x y))
(5 (spawn ^block x y 'copper))
(6 (spawn ^block x y 'crate))
(7 (spawn ^clock-emitter x y 4))
(7 (spawn ^clock-emitter x y
(bytevector-u8-ref objects (+ i 3))))
(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)))
@ -86,15 +87,18 @@
(spawn ^electron-warp x y target-x target-y)))
(15 (spawn ^or-gate x y
(bytevector-u8-ref objects (+ i 3))))
(16 (spawn ^switched-emitter x y 4))
(16 (spawn ^switched-emitter x y
(bytevector-u8-ref objects (+ i 3))))
(id (error "invalid level object" id))))
(i* (+ i (match id
;; floor-switch
;; electric-switch
;; electron-warp
((or 8 12 14) 5)
;; clock-emitter
;; logic gates
((or 11 13 15) 4)
;; switched-emitter
((or 7 11 13 15 16) 4)
(_ 3)))))
(when obj
($ level* 'add-object obj))