diff --git a/modules/game/actors.scm b/modules/game/actors.scm index b63cf8e..e4ee96a 100644 --- a/modules/game/actors.scm +++ b/modules/game/actors.scm @@ -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)) diff --git a/modules/game/level.scm b/modules/game/level.scm index 3d5789d..819e056 100644 --- a/modules/game/level.scm +++ b/modules/game/level.scm @@ -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