summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-06-24 19:18:02 +0200
committerAki <nthirtyone@gmail.com>2016-06-24 19:18:02 +0200
commitfee69da24f3f580acbe6682116a9a1636f9736c4 (patch)
tree514563c632e5b797b03053a710155043757c7e5f
parent3006753ee3cbb1a32efb1b094a21885e9d4de858 (diff)
downloadroflnauts-fee69da24f3f580acbe6682116a9a1636f9736c4.zip
roflnauts-fee69da24f3f580acbe6682116a9a1636f9736c4.tar.gz
roflnauts-fee69da24f3f580acbe6682116a9a1636f9736c4.tar.bz2
More sounds
-rw-r--r--player.lua18
-rw-r--r--sounds.lua6
-rw-r--r--sounds/attack.wavbin0 -> 1229 bytes
-rw-r--r--sounds/land.wavbin0 -> 1725 bytes
-rw-r--r--world.lua1
5 files changed, 14 insertions, 11 deletions
diff --git a/player.lua b/player.lua
index 66872c6..70446b4 100644
--- a/player.lua
+++ b/player.lua
@@ -44,8 +44,7 @@ Player = {
portrait_sprite = nil,
portrait_sheet = require "portraits",
-- Sounds
- sfx_death = love.sound.newSoundData("sounds/death.wav"),
- sfx_hit = love.sound.newSoundData("sounds/hit.wav")
+ sfx = require "sounds"
}
-- Constructor of `Player`
@@ -336,6 +335,8 @@ function Player:hit (ox, oy, sx, sy, vx, vy)
end
end
end
+ -- sound
+ self:playSound(4)
end
-- Hittest
@@ -358,7 +359,7 @@ function Player:damage (horizontal, vertical)
self:changeAnimation("damage")
self.combo = math.min(20, self.combo + 1)
self.punchcd = 0.08
- self:playSoundHit()
+ self:playSound(2)
end
-- DIE
@@ -369,7 +370,7 @@ function Player:die ()
self.spawntimer = 1
self.body:setActive(false)
self.world:onNautKilled(self)
- self:playSoundDeath()
+ self:playSound(1)
end
-- And then respawn. Like Jon Snow.
@@ -382,12 +383,7 @@ function Player: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)
+function Player:playSound(sfx)
+ local source = love.audio.newSource(self.sfx[sfx])
source:play()
end \ No newline at end of file
diff --git a/sounds.lua b/sounds.lua
new file mode 100644
index 0000000..d49b2fe
--- /dev/null
+++ b/sounds.lua
@@ -0,0 +1,6 @@
+return {
+ love.sound.newSoundData("sounds/death.wav"),
+ love.sound.newSoundData("sounds/hit.wav"),
+ love.sound.newSoundData("sounds/land.wav"),
+ love.sound.newSoundData("sounds/attack.wav")
+} \ No newline at end of file
diff --git a/sounds/attack.wav b/sounds/attack.wav
new file mode 100644
index 0000000..c52a405
--- /dev/null
+++ b/sounds/attack.wav
Binary files differ
diff --git a/sounds/land.wav b/sounds/land.wav
new file mode 100644
index 0000000..bc5015b
--- /dev/null
+++ b/sounds/land.wav
Binary files differ
diff --git a/world.lua b/world.lua
index 3b645e5..6fd5203 100644
--- a/world.lua
+++ b/world.lua
@@ -336,6 +336,7 @@ function World.beginContact(a, b, coll)
b:getUserData().jumpdouble = true
b:getUserData().salto = false
b:getUserData():createEffect("land")
+ b:getUserData():playSound(3)
end
end
end