fix: add sound to punch and dash

This commit is contained in:
Kazhnuz 2021-04-11 11:08:59 +02:00
parent ddcd393d2a
commit f700eaa8f8
3 changed files with 10 additions and 5 deletions

Binary file not shown.

View file

@ -100,24 +100,28 @@ function PlayerActions:actionSwitch()
end
function PlayerActions:actionRun()
if self.keys["C"].isDown then
if self.keys["C"].isPressed then
if (self:canDoAction("run")) then
self.assets.sfx["dash"]:play()
if (utils.table.contain({"run", "idle"}, self.currentAction)) then
self.currentAction = "run"
elseif (utils.table.contain({"jumpdash", "jump"}, self.currentAction)) then
self.currentAction = "jumpdash"
end
end
elseif (self.currentAction == "run") then
elseif (not self.keys["C"].isDown) then
if (self.currentAction == "run") then
self.currentAction = "idle"
elseif (self.currentAction == "jumpdash") then
self.currentAction = "jump"
end
end
end
function PlayerActions:actionPunch()
if self.keys["C"].isPressed then
if (self:canDoAction("punch")) then
self.assets.sfx["hit"]:play()
self.xsp, self.ysp = utils.math.lengthdir(BASE_SPEED * RUN_FACTOR, math.rad(self.charsetManager.angle[self.charDir]))
self.xsp = -self.xsp
self.currentAction = "punch"

View file

@ -48,6 +48,7 @@ return {
{"hitconnect", "assets/sfx/hitconnect.wav"},
{"jump", "assets/sfx/jump.wav"},
{"fly", "assets/sfx/flight.wav"},
{"dash", "assets/sfx/dash.wav"},
{"woosh", "assets/sfx/woosh.wav"},
{"spincharge", "assets/sfx/spincharge.wav"},
{"spinrelease", "assets/sfx/spinrelease.wav"},