summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-06-22 03:10:11 +0200
committerAki <nthirtyone@gmail.com>2016-06-22 03:10:11 +0200
commit6fbef22a91840e75c5c6247d5e53175fec03e50c (patch)
tree8edad55647d01306610e720502c4c5133dda7147
parentced06333b42001b072f081e123490308f2dec1ce (diff)
downloadroflnauts-6fbef22a91840e75c5c6247d5e53175fec03e50c.zip
roflnauts-6fbef22a91840e75c5c6247d5e53175fec03e50c.tar.gz
roflnauts-6fbef22a91840e75c5c6247d5e53175fec03e50c.tar.bz2
Hit and death sounds
-rw-r--r--player.lua18
-rw-r--r--sounds/death.wavbin9352 -> 20388 bytes
-rw-r--r--sounds/hit.wavbin8219 -> 25760 bytes
-rw-r--r--sounds/jump.wavbin11696 -> 0 bytes
4 files changed, 17 insertions, 1 deletions
diff --git a/player.lua b/player.lua
index 567f908..66872c6 100644
--- a/player.lua
+++ b/player.lua
@@ -42,7 +42,10 @@ Player = {
controller_empty = {isDown = function () return false end},
-- HUD
portrait_sprite = nil,
- portrait_sheet = require "portraits"
+ portrait_sheet = require "portraits",
+ -- Sounds
+ sfx_death = love.sound.newSoundData("sounds/death.wav"),
+ sfx_hit = love.sound.newSoundData("sounds/hit.wav")
}
-- Constructor of `Player`
@@ -355,6 +358,7 @@ function Player:damage (horizontal, vertical)
self:changeAnimation("damage")
self.combo = math.min(20, self.combo + 1)
self.punchcd = 0.08
+ self:playSoundHit()
end
-- DIE
@@ -365,6 +369,7 @@ function Player:die ()
self.spawntimer = 1
self.body:setActive(false)
self.world:onNautKilled(self)
+ self:playSoundDeath()
end
-- And then respawn. Like Jon Snow.
@@ -374,4 +379,15 @@ function Player:respawn ()
self.body:setPosition(self.world:getSpawnPosition())
self.body:setActive(true)
self:createEffect("respawn")
+end
+
+-- Sounds
+function Player:playSoundHit()
+ local source = love.audio.newSource(self.sfx_hit)
+ source:play()
+end
+
+function Player:playSoundDeath()
+ local source = love.audio.newSource(self.sfx_death)
+ source:play()
end \ No newline at end of file
diff --git a/sounds/death.wav b/sounds/death.wav
index 8ceb430..f37ce03 100644
--- a/sounds/death.wav
+++ b/sounds/death.wav
Binary files differ
diff --git a/sounds/hit.wav b/sounds/hit.wav
index a5690a8..ca1e7b6 100644
--- a/sounds/hit.wav
+++ b/sounds/hit.wav
Binary files differ
diff --git a/sounds/jump.wav b/sounds/jump.wav
deleted file mode 100644
index 971870a..0000000
--- a/sounds/jump.wav
+++ /dev/null
Binary files differ