feat(cbs): add basis for the 3-hit combo
This commit is contained in:
parent
721b0ff04d
commit
7eec984344
2 changed files with 17 additions and 0 deletions
|
@ -19,7 +19,9 @@ end
|
||||||
function Battler:update(dt)
|
function Battler:update(dt)
|
||||||
if (self.isActive) then
|
if (self.isActive) then
|
||||||
self.debugActiveTimer = self.debugActiveTimer + dt
|
self.debugActiveTimer = self.debugActiveTimer + dt
|
||||||
|
core.debug:print("cbs/battler", "debug timer is " .. math.floor(self.debugActiveTimer*100) .. " for battler " .. self.id)
|
||||||
if self.debugActiveTimer >= 0.5 then
|
if self.debugActiveTimer >= 0.5 then
|
||||||
|
core.debug:print("cbs/battler", "counter ended, switching active battler")
|
||||||
self.world:switchActiveBattler()
|
self.world:switchActiveBattler()
|
||||||
self.isActive = false
|
self.isActive = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,6 +35,7 @@ end
|
||||||
-- Function to set or unset activity to the character
|
-- Function to set or unset activity to the character
|
||||||
|
|
||||||
function Hero:setActive()
|
function Hero:setActive()
|
||||||
|
core.debug:print("cbs/hero", "hero " .. self.charid .. " is now active")
|
||||||
local gridsize = game.characters.list[self.charid].base_stats.move
|
local gridsize = game.characters.list[self.charid].base_stats.move
|
||||||
if (gridsize == nil) then
|
if (gridsize == nil) then
|
||||||
gridsize = 3
|
gridsize = 3
|
||||||
|
@ -144,6 +145,8 @@ function Hero:receiveSignal(action_type, id)
|
||||||
if (action_type == "defend") then
|
if (action_type == "defend") then
|
||||||
self.turnAction = "defend"
|
self.turnAction = "defend"
|
||||||
self.world:switchActiveBattler( )
|
self.world:switchActiveBattler( )
|
||||||
|
elseif (action_type == "attack") then
|
||||||
|
self:changeAnimation("hit1")
|
||||||
else
|
else
|
||||||
self.world:switchActiveBattler( )
|
self.world:switchActiveBattler( )
|
||||||
end
|
end
|
||||||
|
@ -179,6 +182,18 @@ function Hero:initSprite()
|
||||||
self:changeAnimation("idle")
|
self:changeAnimation("idle")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Hero:animationEnded(animation)
|
||||||
|
if (animation == "hit1") then
|
||||||
|
self:changeAnimation("hit2")
|
||||||
|
elseif (animation == "hit2") then
|
||||||
|
self:changeAnimation("hit3")
|
||||||
|
elseif (animation == "hit3") then
|
||||||
|
core.debug:print("cbs/hero", "normal combo finished, switching actor")
|
||||||
|
self:changeAnimation("idle")
|
||||||
|
self.world:switchActiveBattler( )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- DRAW FUNCTIONS
|
-- DRAW FUNCTIONS
|
||||||
-- Draw everything related to the hero
|
-- Draw everything related to the hero
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue