From 7eec984344e0bab3e1f3ffb231897240ad8acac6 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Wed, 14 Aug 2019 20:44:20 +0200 Subject: [PATCH] feat(cbs): add basis for the 3-hit combo --- .../scenes/battlesystem/actors/battler.lua | 2 ++ .../scenes/battlesystem/actors/hero.lua | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua index 08391cb..50bd9d3 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua @@ -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 diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index 4658704..fa660bf 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -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