Add gate and warp sound effects.

This commit is contained in:
David Thompson 2024-05-23 07:48:53 -04:00
parent a24d737bc7
commit d4065aa2bf
4 changed files with 16 additions and 7 deletions

BIN
assets/sounds/gate.wav Normal file

Binary file not shown.

BIN
assets/sounds/warp.wav Normal file

Binary file not shown.

View file

@ -67,6 +67,8 @@
(define audio:exit (load-sound-effect "exit"))
(define audio:pickup (load-sound-effect "pickup"))
(define audio:die (load-sound-effect "die"))
(define audio:gate (load-sound-effect "gate"))
(define audio:warp (load-sound-effect "warp"))
(define audio:electric-switch-on (load-sound-effect "electric-switch-on"))
(define audio:electric-switch-off (load-sound-effect "electric-switch-off"))
@ -226,10 +228,14 @@
;; TODO: Maybe show a little achievement popup when all gems
;; are collected?
(set! *gems* (cons *level-idx* *gems*)))
((or ('gate-open x y) ('gate-close x y))
(play-sound-effect audio:gate))
(('electric-switch-on x y)
(play-sound-effect audio:electric-switch-on))
(('electric-switch-off x y)
(play-sound-effect audio:electric-switch-off))
(('receive-electron x y)
(play-sound-effect audio:warp 0.25))
(_ (values)))
(lp rest))))
(update-objects!)

View file

@ -170,7 +170,7 @@
(#f (pk "no switch target!"))
(target
($ grid-info 'append-event `(floor-switch-off ,x ,y))
($ target 'deactivate)))))
($ target 'deactivate grid-info)))))
(('wire-state grid-info) #f)
(('update-wire-state grid-info) #f)
(('alive?) #t)
@ -181,7 +181,7 @@
(#f (pk "no switch target!"))
(target
($ grid-info 'append-event `(floor-switch-on ,x ,y))
($ target 'activate))))))
($ target 'activate grid-info))))))
(define (^electric-switch bcom x y target-x target-y)
(define position (vector x y 0))
@ -205,7 +205,7 @@
(#f (pk "no switch target!"))
(target
($ grid-info 'append-event `(electric-switch-off ,x ,y))
($ target 'deactivate)))))
($ target 'deactivate grid-info)))))
(when (>= ($ grid-info 'wireworld-neighbor-count x y) 1)
($ on? #t)
($ timer 2)
@ -213,7 +213,7 @@
(#f (pk "no switch target!"))
(target
($ grid-info 'append-event `(electric-switch-on ,x ,y))
($ target 'activate))))))
($ target 'activate grid-info))))))
(('alive?) #t)
(('describe) `(electric-switch ,position ,($ on?)))
(('collide other offset grid-info) #f)))
@ -305,9 +305,12 @@
(('post-tick grid-info) #f)
(('enter obj grid-info) #f)
(('exit obj grid-info) #f)
;; TODO: Send grid-info
(('activate) ($ open? #t))
(('deactivate) ($ open? #f))
(('activate grid-info)
($ open? #t)
($ grid-info 'append-event `(gate-open ,x ,y)))
(('deactivate grid-info)
($ open? #f)
($ grid-info 'append-event `(gate-close ,x ,y)))
(('wire-state grid-info) #f)
(('update-wire-state grid-info) #f)
(('alive?) #t)