summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-07-17 11:57:40 +0200
committerAki <nthirtyone@gmail.com>2016-07-17 11:57:40 +0200
commit208a534b5c17914152097333b4b69e43289ae614 (patch)
treeb6072e3a568dab97bf4305ceaa93f1bccde621c8
parentccb596c7bfe6a83737d3847ca3930c8c1b335297 (diff)
downloadroflnauts-208a534b5c17914152097333b4b69e43289ae614.zip
roflnauts-208a534b5c17914152097333b4b69e43289ae614.tar.gz
roflnauts-208a534b5c17914152097333b4b69e43289ae614.tar.bz2
Dead don't talk
-rw-r--r--player.lua8
1 files 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