feat(cbs): start adding character voices
This commit is contained in:
parent
7a8696726b
commit
d84001c150
3 changed files with 25 additions and 0 deletions
Binary file not shown.
Binary file not shown.
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue