From 1a6b183f2b3457b62b7a403209bec6184c6c6106 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 10 Feb 2017 00:13:01 +0100 Subject: Cheer sound played on last naut being killed --- assets/sounds/cheer.ogg | Bin 0 -> 62569 bytes player.lua | 4 ++-- sounds.lua | 3 ++- world.lua | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 assets/sounds/cheer.ogg diff --git a/assets/sounds/cheer.ogg b/assets/sounds/cheer.ogg new file mode 100644 index 0000000..69ae7dc Binary files /dev/null and b/assets/sounds/cheer.ogg differ diff --git a/player.lua b/player.lua index 6195da6..f08ca19 100644 --- a/player.lua +++ b/player.lua @@ -439,8 +439,8 @@ function Player:respawn() end -- Sounds -function Player:playSound(sfx) - if self.alive then +function Player:playSound(sfx, force) + if self.alive or force then local source = love.audio.newSource(self.sfx[sfx]) source:play() end diff --git a/sounds.lua b/sounds.lua index 9c32d24..6c888e1 100644 --- a/sounds.lua +++ b/sounds.lua @@ -2,5 +2,6 @@ return { love.sound.newSoundData("assets/sounds/death.ogg"), love.sound.newSoundData("assets/sounds/hit.ogg"), love.sound.newSoundData("assets/sounds/land.ogg"), - love.sound.newSoundData("assets/sounds/attack.ogg") + love.sound.newSoundData("assets/sounds/attack.ogg"), + love.sound.newSoundData("assets/sounds/cheer.ogg") } \ No newline at end of file diff --git a/world.lua b/world.lua index 30359fd..f2af28d 100644 --- a/world.lua +++ b/world.lua @@ -216,6 +216,7 @@ function World:onNautKilled(naut) changeScene(Menu:new()) elseif #nauts < 2 then self.lastNaut = true + naut:playSound(5, true) end end -- cgit v1.1