Implement orientation for logic gates

Note that orientation is called "direction" because it's named according to the
direction of electron flow.
This commit is contained in:
Juliana Sims 2024-05-23 14:00:55 -04:00
parent 7803eaba1c
commit 73ffad19f0
5 changed files with 219 additions and 38 deletions

View file

@ -74,15 +74,18 @@
(spawn ^ghost-gem x y)
(spawn ^gem x y)))
(10 (spawn ^gate x y))
(11 (spawn ^and-gate x y))
(11 (spawn ^and-gate x y
(bytevector-u8-ref objects (+ i 3))))
(12 (let ((target-x (bytevector-u8-ref objects (+ i 3)))
(target-y (bytevector-u8-ref objects (+ i 4))))
(spawn ^electric-switch x y target-x target-y)))
(13 (spawn ^xor-gate x y))
(13 (spawn ^xor-gate x y
(bytevector-u8-ref objects (+ i 3))))
(14 (let ((target-x (bytevector-u8-ref objects (+ i 3)))
(target-y (bytevector-u8-ref objects (+ i 4))))
(spawn ^electron-warp x y target-x target-y)))
(15 (spawn ^or-gate x y))
(15 (spawn ^or-gate x y
(bytevector-u8-ref objects (+ i 3))))
(16 (spawn ^switched-emitter x y 4))
(id (error "invalid level object" id))))
(i* (+ i (match id
@ -90,6 +93,7 @@
;; electric-switch
;; electron-warp
((or 8 12 14) 5)
((or 11 13 15) 4)
(_ 3)))))
(when obj
($ level* 'add-object obj))