Combine ^gem and ^ghost-gem into one actor.
We still want the ghost gems to be collectable, even though they don't do anything.
This commit is contained in:
parent
e580454a97
commit
3503aeb00b
2 changed files with 8 additions and 22 deletions
|
@ -12,7 +12,6 @@
|
|||
^bomb
|
||||
^brick
|
||||
^gem
|
||||
^ghost-gem
|
||||
^and-gate
|
||||
^xor-gate
|
||||
^or-gate
|
||||
|
@ -382,8 +381,9 @@
|
|||
(('describe) `(bomb ,position ,($ exploding?)))
|
||||
(('collide other offset grid-info) #f)))
|
||||
|
||||
;; TODO: Combine with ghost gem.
|
||||
(define (^gem bcom x y)
|
||||
;; A gem that has already been collected previously will still appear
|
||||
;; in the level but it will be drawn differently.
|
||||
(define (^gem bcom x y previously-collected?)
|
||||
(define position (vector x y 1))
|
||||
(define picked-up? (spawn ^cell))
|
||||
(match-lambda*
|
||||
|
@ -396,27 +396,15 @@
|
|||
(('wire-state grid-info from from-x from-y) #f)
|
||||
(('update-wire-state grid-info neighbor-grid) #f)
|
||||
(('alive?) (not ($ picked-up?)))
|
||||
(('describe) `(gem ,position))
|
||||
(('describe)
|
||||
(if previously-collected?
|
||||
`(ghost-gem ,position)
|
||||
`(gem ,position)))
|
||||
(('collide other offset grid-info)
|
||||
(when (eq? ($ other 'type) 'player)
|
||||
($ picked-up? #t)
|
||||
($ grid-info 'append-event `(pickup ,x ,y))))))
|
||||
|
||||
(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 from from-x from-y) #f)
|
||||
(('update-wire-state grid-info neighbor-grid) #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))
|
||||
|
|
|
@ -77,9 +77,7 @@
|
|||
(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 (if collected-gem?
|
||||
(spawn ^ghost-gem x y)
|
||||
(spawn ^gem x y)))
|
||||
(9 (spawn ^gem x y collected-gem?))
|
||||
(10 (spawn ^gate x y))
|
||||
(11 (spawn ^and-gate x y
|
||||
(direction->symbol
|
||||
|
|
Loading…
Add table
Reference in a new issue