From e2d788e012097b665d7ed7c6b2d0d9856690a03e Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 15 Aug 2019 08:57:47 +0200 Subject: [PATCH] improvement(cbs): improve animation speed --- .../datas/gamedata/characters/sonic/sprites.lua | 6 +++--- .../scenes/battlesystem/actors/hero.lua | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua b/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua index 790ebd9..ce7771f 100644 --- a/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua +++ b/sonic-radiance.love/datas/gamedata/characters/sonic/sprites.lua @@ -39,21 +39,21 @@ return { startAt = 22, endAt = 26, loop = 26, - speed = 10, + speed = 15, pauseAtEnd = true, }, ["hit2"] = { startAt = 28, endAt = 31, loop = 31, - speed = 10, + speed = 15, pauseAtEnd = true, }, ["hit3"] = { startAt = 32, endAt = 36, loop = 36, - speed = 10, + speed = 15, pauseAtEnd = true, }, } diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index 1488eb1..9c0cab3 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -74,15 +74,15 @@ function Hero:updateMoving(dt) self.yprevious = self.y -- Move the player toward its destination - self.x = (self.x) + ((self.dx) - (self.x)) * dt*15 - self.y = (self.y) + ((self.dy) - (self.y)) * dt*15 + self.x = (self.x) + ((self.dx) - (self.x)) * dt*10 + self.y = (self.y) + ((self.dy) - (self.y)) * dt*10 -- Calculate speed to calculate animation speed local xspeed, yspeed = math.abs(self.x - self.xprevious), math.abs(self.y - self.yprevious) local speed = math.sqrt(xspeed*xspeed + yspeed*yspeed) * 32 - self:setCustomSpeed(speed * 60) + self:setCustomSpeed(speed * 10) -- Handle direction local direction = utils.math.sign(self.x - self.xprevious) @@ -114,14 +114,14 @@ function Hero:updateDirectionSelection(dt) self.xprevious = self.x self.yprevious = self.y - self.x = (self.x) + ((self.startx) - (self.x)) * dt*15 - self.y = (self.y) + ((self.starty) - (self.y)) * dt*15 + self.x = (self.x) + ((self.startx) - (self.x)) * dt*10 + self.y = (self.y) + ((self.starty) - (self.y)) * dt*10 local xspeed, yspeed = math.abs(self.x - self.xprevious), math.abs(self.y - self.yprevious) local speed = math.sqrt(xspeed*xspeed + yspeed*yspeed) * 32 - self:setCustomSpeed(speed * 60) + self:setCustomSpeed(speed * 10) local direction = utils.math.sign(self.x - self.xprevious) if direction ~= 0 then self.direction = direction