Skip to content
This repository was archived by the owner on Aug 1, 2020. It is now read-only.

Commit

Permalink
Merge branch 'sounds'
Browse files Browse the repository at this point in the history
  • Loading branch information
nthirtyone committed Feb 24, 2017
2 parents 7c37217 + 044313e commit 5f013c9
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 4 deletions.
Binary file modified assets/sounds/attack.ogg
Binary file not shown.
Binary file added assets/sounds/cheer.ogg
Binary file not shown.
Binary file modified assets/sounds/death.ogg
Binary file not shown.
Binary file modified assets/sounds/hit.ogg
Binary file not shown.
Binary file added assets/sounds/jump.ogg
Binary file not shown.
Binary file removed assets/sounds/land.ogg
Binary file not shown.
Binary file added assets/sounds/spawn.ogg
Binary file not shown.
Binary file added assets/sounds/step.ogg
Binary file not shown.
6 changes: 4 additions & 2 deletions player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ function Player:controlpressed(set, action, key)
if self.jumpnumber > 0 then
-- General jump logics
self.jumpactive = true
--self:playSound(6)
-- Spawn proper effect
if not self.inAir then
self:createEffect("jump")
Expand Down Expand Up @@ -436,11 +437,12 @@ function Player:respawn()
self.body:setPosition(self.world:getSpawnPosition())
self.body:setActive(true)
self:createEffect("respawn")
self:playSound(7)
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
Expand Down
7 changes: 5 additions & 2 deletions sounds.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
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/step.ogg"),
love.sound.newSoundData("assets/sounds/attack.ogg"),
love.sound.newSoundData("assets/sounds/cheer.ogg"),
love.sound.newSoundData("assets/sounds/jump.ogg"),
love.sound.newSoundData("assets/sounds/spawn.ogg"),
}
1 change: 1 addition & 0 deletions world.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ function World:onNautKilled(naut)
changeScene(Menu:new())
elseif #nauts < 2 then
self.lastNaut = true
naut:playSound(5, true)
end
end

Expand Down

0 comments on commit 5f013c9

Please sign in to comment.