diff --git a/sonic-radiance.love/birb/modules/assets/types/animator.lua b/sonic-radiance.love/birb/modules/assets/types/animator.lua index 2f31ab9..bf45ddb 100644 --- a/sonic-radiance.love/birb/modules/assets/types/animator.lua +++ b/sonic-radiance.love/birb/modules/assets/types/animator.lua @@ -35,6 +35,7 @@ function Animator:new(sprite) self.animationData = {} self.customSpeed = 0 + self.speedFactor = 1 self:changeToDefaultAnimation() end @@ -43,6 +44,10 @@ function Animator:setCustomSpeed(customSpeed) self.customSpeed = customSpeed or 0 end +function Animator:setSpeedFactor(speedFactor) + self.speedFactor = speedFactor or 1 +end + -- UPDATE FUNCTIONS -- Update the animation of the animator @@ -56,7 +61,7 @@ function Animator:update(dt) if (self.animationData.speed) == -1 then speed = self.customSpeed --math.abs(self.xsp / 16) end - self.frameTimer = self.frameTimer + (speed * dt) + self.frameTimer = self.frameTimer + (speed * dt * self.speedFactor) if self.frameTimer > 1 then self.frameTimer = 0 if self.frame == self.animationData.endAt then diff --git a/sonic-radiance.love/birb/modules/assets/types/sprites.lua b/sonic-radiance.love/birb/modules/assets/types/sprites.lua index f33b919..b7cf49d 100644 --- a/sonic-radiance.love/birb/modules/assets/types/sprites.lua +++ b/sonic-radiance.love/birb/modules/assets/types/sprites.lua @@ -63,6 +63,10 @@ function Sprite:changeAnimation(name, restart) self.animator:changeAnimation(name, restart) end +function Sprite:setSpeedFactor(speedFactor) + self.animator:setSpeedFactor(speedFactor) +end + -- INFO FUNCTIONS -- get information with these functions