feat(hero): wait a bit before use the switchActiveBattler function
This commit is contained in:
parent
6c81408126
commit
1217ec0d10
1 changed files with 13 additions and 3 deletions
|
@ -146,11 +146,11 @@ function Hero:receiveSignal(action_type, id)
|
||||||
end
|
end
|
||||||
if (action_type == "defend") then
|
if (action_type == "defend") then
|
||||||
self.turnAction = "defend"
|
self.turnAction = "defend"
|
||||||
self.world:switchActiveBattler( )
|
self:switchActiveBattler( )
|
||||||
elseif (action_type == "attack") then
|
elseif (action_type == "attack") then
|
||||||
self:changeAnimation("hit1")
|
self:changeAnimation("hit1")
|
||||||
else
|
else
|
||||||
self.world:switchActiveBattler( )
|
self:switchActiveBattler( )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -160,6 +160,12 @@ function Hero:receiveBackSignal()
|
||||||
self:changeAnimation("walk")
|
self:changeAnimation("walk")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Hero:timerResponse(timer)
|
||||||
|
if timer == "switchActiveBattler" then
|
||||||
|
self.world:switchActiveBattler()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- ACTION FUNCTIONS
|
-- ACTION FUNCTIONS
|
||||||
-- All functions related to actions
|
-- All functions related to actions
|
||||||
|
|
||||||
|
@ -173,6 +179,10 @@ function Hero:validateAction()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Hero:switchActiveBattler()
|
||||||
|
self.tweens:newTimer(0.15, "switchActiveBattler")
|
||||||
|
end
|
||||||
|
|
||||||
-- SPRITE FUNCTIONS
|
-- SPRITE FUNCTIONS
|
||||||
-- Handle the hero sprite
|
-- Handle the hero sprite
|
||||||
|
|
||||||
|
@ -195,7 +205,7 @@ function Hero:animationEnded(animation)
|
||||||
self:sendDamage(self.x + self.direction, self.y, 33, 100, false, false)
|
self:sendDamage(self.x + self.direction, self.y, 33, 100, false, false)
|
||||||
core.debug:print("cbs/hero", "normal combo finished, switching actor")
|
core.debug:print("cbs/hero", "normal combo finished, switching actor")
|
||||||
self:changeAnimation("idle")
|
self:changeAnimation("idle")
|
||||||
self.world:switchActiveBattler( )
|
self:switchActiveBattler( )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue