modules/world: refactor movement functions together

This commit is contained in:
Kazhnuz 2019-05-05 21:25:25 +02:00
parent 4b4b8b4e85
commit 11fcc4cf99

View file

@ -38,12 +38,7 @@ end
function Actor2D:initPhysics(x, y, w, h, isSolid)
self:initHitbox(x, y, w, h)
self.xsp = 0
self.ysp = 0
self.xfrc = 0
self.yfrc = 0
self:initMovement()
self:setBounceFactor()
self:initGravity()
@ -70,6 +65,14 @@ function Actor2D:setFilter()
end
end
function Actor2D:initMovement()
self.xsp = 0
self.ysp = 0
self.xfrc = 0
self.yfrc = 0
end
function Actor2D:autoMove(dt)
self.onGround = false
self:applyGravity(dt)