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
|
||||
if (action_type == "defend") then
|
||||
self.turnAction = "defend"
|
||||
self.world:switchActiveBattler( )
|
||||
self:switchActiveBattler( )
|
||||
elseif (action_type == "attack") then
|
||||
self:changeAnimation("hit1")
|
||||
else
|
||||
self.world:switchActiveBattler( )
|
||||
self:switchActiveBattler( )
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -160,6 +160,12 @@ function Hero:receiveBackSignal()
|
|||
self:changeAnimation("walk")
|
||||
end
|
||||
|
||||
function Hero:timerResponse(timer)
|
||||
if timer == "switchActiveBattler" then
|
||||
self.world:switchActiveBattler()
|
||||
end
|
||||
end
|
||||
|
||||
-- ACTION FUNCTIONS
|
||||
-- All functions related to actions
|
||||
|
||||
|
@ -173,6 +179,10 @@ function Hero:validateAction()
|
|||
end
|
||||
end
|
||||
|
||||
function Hero:switchActiveBattler()
|
||||
self.tweens:newTimer(0.15, "switchActiveBattler")
|
||||
end
|
||||
|
||||
-- SPRITE FUNCTIONS
|
||||
-- Handle the hero sprite
|
||||
|
||||
|
@ -195,7 +205,7 @@ function Hero:animationEnded(animation)
|
|||
self:sendDamage(self.x + self.direction, self.y, 33, 100, false, false)
|
||||
core.debug:print("cbs/hero", "normal combo finished, switching actor")
|
||||
self:changeAnimation("idle")
|
||||
self.world:switchActiveBattler( )
|
||||
self:switchActiveBattler( )
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue