modules/world: refactor movement functions together
This commit is contained in:
parent
4b4b8b4e85
commit
11fcc4cf99
1 changed files with 9 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue