diff --git a/examples/gameplay/moveplayer/actors/player.lua b/examples/gameplay/moveplayer/actors/player.lua index debbd8d..1a68bc2 100644 --- a/examples/gameplay/moveplayer/actors/player.lua +++ b/examples/gameplay/moveplayer/actors/player.lua @@ -9,16 +9,16 @@ end function Player:update(dt) self.xsp, self.ysp = 0, 0 if self.keys["up"].isDown then - self.ysp = -120 * dt + self.ysp = -120 end if self.keys["down"].isDown then - self.ysp = 120 * dt + self.ysp = 120 end if self.keys["left"].isDown then - self.xsp = -120 * dt + self.xsp = -120 end if self.keys["right"].isDown then - self.xsp = 120 * dt + self.xsp = 120 end Player.super.update(self, dt) diff --git a/gamecore/modules/world/actors/actor2D.lua b/gamecore/modules/world/actors/actor2D.lua index d8c6be4..9273acc 100644 --- a/gamecore/modules/world/actors/actor2D.lua +++ b/gamecore/modules/world/actors/actor2D.lua @@ -75,7 +75,7 @@ end function Actor2D:update(dt) - self:autoMove() + self:autoMove(dt) end -- MOVEMENT FUNCTIONS @@ -88,8 +88,8 @@ function Actor2D:setFilter() end end -function Actor2D:autoMove() - self:move(self.x + self.xsp, self.y + self.ysp) +function Actor2D:autoMove(dt) + self:move(self.x + self.xsp * dt, self.y + self.ysp * dt) end function Actor2D:move(newx, newy)