feat(cbs): add basis for the 3-hit combo

This commit is contained in:
Kazhnuz 2019-08-14 20:44:20 +02:00
parent 721b0ff04d
commit 7eec984344
2 changed files with 17 additions and 0 deletions

View file

@ -19,7 +19,9 @@ end
function Battler:update(dt)
if (self.isActive) then
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
core.debug:print("cbs/battler", "counter ended, switching active battler")
self.world:switchActiveBattler()
self.isActive = false
end

View file

@ -35,6 +35,7 @@ end
-- Function to set or unset activity to the character
function Hero:setActive()
core.debug:print("cbs/hero", "hero " .. self.charid .. " is now active")
local gridsize = game.characters.list[self.charid].base_stats.move
if (gridsize == nil) then
gridsize = 3
@ -144,6 +145,8 @@ function Hero:receiveSignal(action_type, id)
if (action_type == "defend") then
self.turnAction = "defend"
self.world:switchActiveBattler( )
elseif (action_type == "attack") then
self:changeAnimation("hit1")
else
self.world:switchActiveBattler( )
end
@ -179,6 +182,18 @@ function Hero:initSprite()
self:changeAnimation("idle")
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 everything related to the hero