Sound
This commit is contained in:
parent
819ff13835
commit
6cac704bc5
|
@ -8,6 +8,9 @@
|
|||
(require racket/promise)
|
||||
(require plot/utils) ;; for vector utilities
|
||||
|
||||
(require (only-in racket/string string-prefix?))
|
||||
(require (only-in racket/gui/base play-sound))
|
||||
|
||||
(require syndicate)
|
||||
(require syndicate/drivers/timer)
|
||||
(require syndicate-gl/2d)
|
||||
|
@ -394,6 +397,7 @@
|
|||
[(message (add-to-score delta))
|
||||
(define new-score (+ s delta))
|
||||
(log-info "Score increased by ~a to ~a" delta new-score)
|
||||
(play-sound-sequence 270304)
|
||||
(define message (text (format "Score: ~a" new-score) 24 "white"))
|
||||
(transition new-score
|
||||
(patch-seq (retract (current-score ?))
|
||||
|
@ -608,6 +612,7 @@
|
|||
(define pos (piece-pos s id))
|
||||
(define support (find-support pos (game-piece-configuration-size g) s))
|
||||
(and support
|
||||
(play-sound-sequence 270318)
|
||||
((update-piece g pos (v+ pos (vector 0 -1)) jump-vel) s)))
|
||||
|
||||
(spawn (lambda (e s)
|
||||
|
@ -827,7 +832,8 @@
|
|||
(values (cons who to-damage) squashed?))))
|
||||
(define damage-actions (for/list [(who to-damage)] (message (damage who 1))))
|
||||
(if squashed?
|
||||
(quit (list damage-actions (message (at-meta (add-to-score 1)))))
|
||||
(begin (play-sound-sequence 270325)
|
||||
(quit (list damage-actions (message (at-meta (add-to-score 1))))))
|
||||
(transition s damage-actions)))
|
||||
|
||||
(spawn (lambda (e s)
|
||||
|
@ -903,9 +909,11 @@
|
|||
(match e
|
||||
[(? patch/removed?)
|
||||
(log-info "Player died! Terminating level.")
|
||||
(play-sound-sequence 270328)
|
||||
(transition s (quit-dataspace))]
|
||||
[(message (at-meta (level-completed)))
|
||||
(log-info "Level completed! Terminating level.")
|
||||
(play-sound-sequence 270330)
|
||||
(transition s (list (message (at-meta (add-to-score 100)))
|
||||
(quit-dataspace)))]
|
||||
[_ #f]))
|
||||
|
@ -1025,6 +1033,24 @@
|
|||
(sub (level-completed))))
|
||||
(spawn-numbered-level starting-level)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Sounds
|
||||
|
||||
(define (lookup-sound-file sound-number)
|
||||
(define sought-prefix (format "sounds/~a__" sound-number))
|
||||
(for/or [(filename (in-directory "sounds"))]
|
||||
(and (string-prefix? (path->string filename) sought-prefix)
|
||||
filename)))
|
||||
|
||||
;; TODO: make this a sound driver...
|
||||
;; TODO: ...and make sound triggering based on assertions of game
|
||||
;; state, not hardcoding in game logic
|
||||
(define (play-sound-sequence . sound-numbers)
|
||||
(thread (lambda ()
|
||||
(for [(sound-number (in-list sound-numbers))]
|
||||
(define sound-file (lookup-sound-file sound-number))
|
||||
(play-sound sound-file #f)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define game-level 3) ;; used to specify meta-level to reach external I/O
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,140 @@
|
|||
Sound pack downloaded from Freesound.org
|
||||
----------------------------------------
|
||||
|
||||
This pack of sounds contains sounds by LittleRobotSoundFactory ( https://www.freesound.org/people/LittleRobotSoundFactory/ )
|
||||
You can find this pack online at: https://www.freesound.org/people/LittleRobotSoundFactory/packs/16681/
|
||||
|
||||
|
||||
License details
|
||||
---------------
|
||||
|
||||
Sampling+: http://creativecommons.org/licenses/sampling+/1.0/
|
||||
Creative Commons 0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
Attribution: http://creativecommons.org/licenses/by/3.0/
|
||||
Attribution Noncommercial: http://creativecommons.org/licenses/by-nc/3.0/
|
||||
|
||||
|
||||
Sounds in this pack
|
||||
-------------------
|
||||
|
||||
* 270344__littlerobotsoundfactory__shoot-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270344/
|
||||
* license: Attribution
|
||||
* 270343__littlerobotsoundfactory__shoot-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270343/
|
||||
* license: Attribution
|
||||
* 270342__littlerobotsoundfactory__pickup-03.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270342/
|
||||
* license: Attribution
|
||||
* 270341__littlerobotsoundfactory__pickup-04.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270341/
|
||||
* license: Attribution
|
||||
* 270340__littlerobotsoundfactory__pickup-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270340/
|
||||
* license: Attribution
|
||||
* 270339__littlerobotsoundfactory__pickup-02.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270339/
|
||||
* license: Attribution
|
||||
* 270338__littlerobotsoundfactory__open-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270338/
|
||||
* license: Attribution
|
||||
* 270337__littlerobotsoundfactory__pickup-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270337/
|
||||
* license: Attribution
|
||||
* 270336__littlerobotsoundfactory__shoot-02.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270336/
|
||||
* license: Attribution
|
||||
* 270335__littlerobotsoundfactory__shoot-03.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270335/
|
||||
* license: Attribution
|
||||
* 270334__littlerobotsoundfactory__jingle-lose-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270334/
|
||||
* license: Attribution
|
||||
* 270333__littlerobotsoundfactory__jingle-win-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270333/
|
||||
* license: Attribution
|
||||
* 270332__littlerobotsoundfactory__hit-03.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270332/
|
||||
* license: Attribution
|
||||
* 270331__littlerobotsoundfactory__jingle-achievement-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270331/
|
||||
* license: Attribution
|
||||
* 270330__littlerobotsoundfactory__jingle-achievement-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270330/
|
||||
* license: Attribution
|
||||
* 270329__littlerobotsoundfactory__jingle-lose-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270329/
|
||||
* license: Attribution
|
||||
* 270328__littlerobotsoundfactory__hero-death-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270328/
|
||||
* license: Attribution
|
||||
* 270327__littlerobotsoundfactory__hit-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270327/
|
||||
* license: Attribution
|
||||
* 270326__littlerobotsoundfactory__hit-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270326/
|
||||
* license: Attribution
|
||||
* 270325__littlerobotsoundfactory__hit-02.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270325/
|
||||
* license: Attribution
|
||||
* 270324__littlerobotsoundfactory__menu-navigate-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270324/
|
||||
* license: Attribution
|
||||
* 270323__littlerobotsoundfactory__jump-03.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270323/
|
||||
* license: Attribution
|
||||
* 270322__littlerobotsoundfactory__menu-navigate-02.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270322/
|
||||
* license: Attribution
|
||||
* 270321__littlerobotsoundfactory__menu-navigate-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270321/
|
||||
* license: Attribution
|
||||
* 270320__littlerobotsoundfactory__jump-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270320/
|
||||
* license: Attribution
|
||||
* 270319__littlerobotsoundfactory__jingle-win-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270319/
|
||||
* license: Attribution
|
||||
* 270318__littlerobotsoundfactory__jump-02.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270318/
|
||||
* license: Attribution
|
||||
* 270317__littlerobotsoundfactory__jump-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270317/
|
||||
* license: Attribution
|
||||
* 270316__littlerobotsoundfactory__open-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270316/
|
||||
* license: Attribution
|
||||
* 270315__littlerobotsoundfactory__menu-navigate-03.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270315/
|
||||
* license: Attribution
|
||||
* 270311__littlerobotsoundfactory__explosion-03.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270311/
|
||||
* license: Attribution
|
||||
* 270310__littlerobotsoundfactory__explosion-04.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270310/
|
||||
* license: Attribution
|
||||
* 270309__littlerobotsoundfactory__craft-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270309/
|
||||
* license: Attribution
|
||||
* 270308__littlerobotsoundfactory__explosion-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270308/
|
||||
* license: Attribution
|
||||
* 270307__littlerobotsoundfactory__explosion-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270307/
|
||||
* license: Attribution
|
||||
* 270306__littlerobotsoundfactory__explosion-02.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270306/
|
||||
* license: Attribution
|
||||
* 270305__littlerobotsoundfactory__climb-rope-loop-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270305/
|
||||
* license: Attribution
|
||||
* 270304__littlerobotsoundfactory__collect-point-00.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270304/
|
||||
* license: Attribution
|
||||
* 270303__littlerobotsoundfactory__collect-point-01.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270303/
|
||||
* license: Attribution
|
||||
* 270302__littlerobotsoundfactory__collect-point-02.wav
|
||||
* url: https://www.freesound.org/people/LittleRobotSoundFactory/sounds/270302/
|
||||
* license: Attribution
|
||||
|
Loading…
Reference in New Issue