From 062070faaed6a2ec77f09b354ae91a9cc3e16f21 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 7 Aug 2021 10:40:07 +0200 Subject: [PATCH] chore: remove tweener-based movement --- .../scenes/battlesystem/actors/movable.lua | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/actors/movable.lua b/sonic-radiance.love/scenes/battlesystem/actors/movable.lua index 00d22be..09d771a 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/movable.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/movable.lua @@ -2,7 +2,6 @@ local ParentObject = require "scenes.battlesystem.actors.parent" local Movable = ParentObject:extend() local MOVEMENT_NONE = "none" -local MOVEMENT_TWEENER = "tweener" local MOVEMENT_MOTION = "motion" local MOVEMENT_TARGET = "target" @@ -50,27 +49,14 @@ end function Movable:stopMoving() self.xspeed, self.yspeed, self.zspeed = 0,0,0 self.speed = 0 - if (self.movementType == MOVEMENT_TWEENER) then - self:finishAction("goTo") - self.tweens:removeNamedTween("goTo") - self.tweens:removeTimer("goTo") - self.tweens:removeTimer("resetMovement") - end self:finishAction("goTo") self:updatePreviousPosition() self:resetMovementType() end function Movable:updateMovement(dt) - if (self.movementType == MOVEMENT_TWEENER) then - self:updateTweenerSpeed(dt) - self.speed = math.sqrt(self.xspeed^2 + self.yspeed^2) - elseif (self.movementType == MOVEMENT_MOTION) or (self.movementType == MOVEMENT_TARGET) then - self:updateMotion(dt) - end - + self:updateMotion(dt) self:updateDirection() - self:updatePreviousPosition() end @@ -80,7 +66,7 @@ function Movable:updatePreviousPosition() self.zprevious = self.z end --- Tweener movement functions +-- GoTo movement functions function Movable:goTo(dx, dy, duration, easing) self:stopMoving() @@ -100,11 +86,6 @@ function Movable:goTo3D(dx, dy, dz, duration, easing) self.movementType = MOVEMENT_TARGET end -function Movable:updateTweenerSpeed(dt) - self.xspeed = (self.x - self.xprevious) / dt - self.yspeed = (self.y - self.yprevious) / dt -end - -- MOTION HANDLING function Movable:setMotion(speed, angle, vertAngle)