From b14e85d7f8851fbdeb27bf6438f21a327c03e840 Mon Sep 17 00:00:00 2001 From: "Jakob L. Kreuze" Date: Thu, 25 Oct 2018 19:54:35 -0400 Subject: Implement sound effects and music --- player.fnl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'player.fnl') diff --git a/player.fnl b/player.fnl index 9b8509a..d9e8475 100644 --- a/player.fnl +++ b/player.fnl @@ -20,6 +20,7 @@ (local draw (require :draw)) (local gravity 128) +(local jump-sfx (love.audio.newSource "sound/jump.wav" "static")) ;; Returns a pair, (x, y) that represents the player's next position, assuming ;; that it did /not/ collide with anything. The role of collision detection, and @@ -69,6 +70,7 @@ (fn jump [player] (tset player :action :jump true) (when (> 10 (math.abs (. player :y-vel))) + (: jump-sfx :play) (tset player :y-vel (- (. player :goal-y-vel))))) (fn bounce [player x-normal y-normal] -- cgit v1.3