Spawn ghost gems where gems used to be.

This commit is contained in:
David Thompson 2024-05-22 18:34:29 -04:00
parent 2dc354229d
commit 111eb33429
6 changed files with 37 additions and 6 deletions

View file

@ -9,6 +9,7 @@
^floor-switch
^gate
^gem
^ghost-gem
^and-gate
^xor-gate
^or-gate
@ -268,6 +269,21 @@
(when (eq? ($ other 'type) 'player)
($ picked-up? #t)))))
(define (^ghost-gem bcom x y)
(define position (vector x y 1))
(match-lambda*
(('type) 'ghost-gem)
(('position) position)
(('tick grid-info) #f)
(('post-tick grid-info) #f)
(('enter obj grid-info) #f)
(('exit obj grid-info) #f)
(('wire-state grid-info) #f)
(('update-wire-state grid-info) #f)
(('alive?) #t)
(('describe) `(ghost-gem ,position))
(('collide other offset grid-info) #f)))
(define (^gate bcom x y)
(define position (vector x y 1))
(define open? (spawn ^cell))
@ -461,6 +477,7 @@
($ event '(bump)))))
('switch ($ event '(switch)))
('gem ($ event '(gem)))
('ghost-gem #t)
('gate
(unless ($ other 'open?)
(reverse-move)