diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic/voices/move.wav b/sonic-radiance.love/datas/gamedata/characters/sonic/voices/move.wav new file mode 100644 index 0000000..c0bb10b Binary files /dev/null and b/sonic-radiance.love/datas/gamedata/characters/sonic/voices/move.wav differ diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic/voices/turnstart.wav b/sonic-radiance.love/datas/gamedata/characters/sonic/voices/turnstart.wav new file mode 100644 index 0000000..a1719d0 Binary files /dev/null and b/sonic-radiance.love/datas/gamedata/characters/sonic/voices/turnstart.wav differ diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index 17e49d9..60f5a13 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -25,6 +25,27 @@ function Hero:new(world, x, y, charid, charnumber) self:initSprite() self:initChoregraphySystem() + + self:initVoices() +end + +-- ASSETS FUNCTIONS +-- Load and play assets needed by the character + +function Hero:initVoices() + self:addVoiceEffect("move") + self:addVoiceEffect("turnstart") +end + +function Hero:addVoiceEffect(name) + local completename = self.charid .. "_" .. name + local path = "datas/gamedata/characters/" .. self.charid .. "/voices/" .. name .. ".wav" + self.assets:newSFX(completename, path) +end + +function Hero:talk(name) + local completename = self.charid .. "_" .. name + self.assets.sfx[completename]:play() end -- INFO FUNCTIONS @@ -49,6 +70,8 @@ function Hero:setActive() self.world.cursor:set(self.startx, self.starty) self.currentAction = "selectDirection" + self:talk("turnstart") + self.directionPrevious = self.direction end @@ -186,6 +209,8 @@ function Hero:validateAction() self.currentAction = "moving" self.dx, self.dy = self.world.cursor.x, self.world.cursor.y + self:talk("move") + self.world.cursor:unset( ) end end