diff --git a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua index 5d1ff26..4918297 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua @@ -120,6 +120,18 @@ function Battler:initMovementSystem() self:initJump() end +function Battler:stopMoving() + self.xspeed, self.yspeed, self.zspeed = 0,0,0 + if (self.movementType == MOVEMENT_TWEENER) then + self:unlockTag("goTo") + self.tweens:removeNamedTween("goTo") + self.tweens:removeTimer("goTo") + self.tweens:removeTimer("resetMovement") + end + self.movementType = MOVEMENT_NONE + self:updatePreviousPosition() +end + function Battler:updateMovement(dt) if (self.movementType == MOVEMENT_TWEENER) then self:updateTweenerSpeed(dt) @@ -144,7 +156,7 @@ end function Battler:goTo(dx, dy, duration, easing) local easing = easing or 'inOutQuad' if duration > 0 then - self.tweens:newTween(0, duration, {x = dx, y = dy}, easing) + self.tweens:setNamedTween("goTo", 0, duration, {x = dx, y = dy}, easing) end self.tweens:newTimer(duration + 0.02, "goTo") self.tweens:newTimer(duration + 0.02, "resetMovement") @@ -197,6 +209,11 @@ function Battler:initJump() self.jump.isMotionJump = false end +function Battler:stopJumping() + self:initJump() + self.zspeed = 0 +end + function Battler:setJump(power, bounceNumber, useDefaultAnimation) self.zspeed = power self.jump.spin = (useDefaultAnimation == false)