From 208a534b5c17914152097333b4b69e43289ae614 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 17 Jul 2016 11:57:40 +0200 Subject: Dead don't talk --- player.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/player.lua b/player.lua index 059269c..052bbab 100644 --- a/player.lua +++ b/player.lua @@ -384,13 +384,13 @@ end -- DIE function Player:die () + self:playSound(1) self.combo = 1 self.lives = self.lives - 1 self.alive = false self.spawntimer = 1 self.body:setActive(false) self.world:onNautKilled(self) - self:playSound(1) end -- And then respawn. Like Jon Snow. @@ -404,6 +404,8 @@ end -- Sounds function Player:playSound(sfx) - local source = love.audio.newSource(self.sfx[sfx]) - source:play() + if self.alive then + local source = love.audio.newSource(self.sfx[sfx]) + source:play() + end end -- cgit v1.1