diff --git a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua index 4918297..5311121 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/battler.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/battler.lua @@ -23,6 +23,7 @@ function Battler:new(world, x, y, z, owner) self.start = {} self.start.x = x self.start.y = y + self.start.z = z self.start.direction = self.direction self:initMovementSystem() @@ -155,6 +156,7 @@ end function Battler:goTo(dx, dy, duration, easing) local easing = easing or 'inOutQuad' + self:stopMoving() if duration > 0 then self.tweens:setNamedTween("goTo", 0, duration, {x = dx, y = dy}, easing) end @@ -164,6 +166,20 @@ function Battler:goTo(dx, dy, duration, easing) self.movementType = MOVEMENT_TWEENER end +function Battler:goTo3D(dx, dy, dz, duration, easing) + local easing = easing or 'inOutQuad' + self:stopMoving() + self:stopJumping() + self.jump.useDefaultAnimation = false + if duration > 0 then + self.tweens:setNamedTween("goTo", 0, duration, {x = dx, y = dy, z = dz}, easing) + end + self.tweens:newTimer(duration + 0.02, "goTo") + self.tweens:newTimer(duration + 0.02, "resetMovement") + + self.movementType = MOVEMENT_TWEENER +end + function Battler:updateTweenerSpeed(dt) self.xspeed = (self.x - self.xprevious) / dt self.yspeed = (self.y - self.yprevious) / dt @@ -216,15 +232,15 @@ end function Battler:setJump(power, bounceNumber, useDefaultAnimation) self.zspeed = power - self.jump.spin = (useDefaultAnimation == false) + self.jump.useDefaultAnimation = useDefaultAnimation self.jump.bounceNumber = bounceNumber self.jump.isJumping = true end -function Battler:jumpTo(dx, dy, height, speed, spinjump) +function Battler:jumpTo(dx, dy, height, speed, useDefaultAnimation) height = height or 4 speed = speed or 8 - self:setJump(height, 0, spinjump) + self:setJump(height, 0, useDefaultAnimation) local dir = utils.math.pointDirection(self.x, self.y, dx, dy) local hspeed, vspeed = utils.math.lengthdir(speed, dir) self:setMotion(hspeed, vspeed) @@ -232,7 +248,7 @@ function Battler:jumpTo(dx, dy, height, speed, spinjump) end function Battler:jumpBack(height, speed) - self:jumpTo(self.start.x, self.start.y, height, speed, false) + self:jumpTo(self.start.x, self.start.y, height, speed, true) end function Battler:updateJump(dt)