fix : some jump fixes
This commit is contained in:
parent
daae72dd8a
commit
9321eb411f
1 changed files with 5 additions and 1 deletions
|
@ -79,6 +79,7 @@ end
|
||||||
|
|
||||||
function Movable:resetMotion()
|
function Movable:resetMotion()
|
||||||
self.speed, self.angle = 0, 0
|
self.speed, self.angle = 0, 0
|
||||||
|
self.xspeed, self.yspeed = 0,0
|
||||||
|
|
||||||
self:updatePreviousPosition()
|
self:updatePreviousPosition()
|
||||||
self:resetMovementType()
|
self:resetMovementType()
|
||||||
|
@ -189,7 +190,7 @@ end
|
||||||
function Movable:updateDirection()
|
function Movable:updateDirection()
|
||||||
-- Handle direction
|
-- Handle direction
|
||||||
if math.abs(self.xspeed) >= 0.01 then
|
if math.abs(self.xspeed) >= 0.01 then
|
||||||
if (self.directionLocked == false) then
|
if not (self.directionLocked or self.jump.lockDir) then
|
||||||
self.direction = utils.math.sign(self.xspeed)
|
self.direction = utils.math.sign(self.xspeed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -203,6 +204,7 @@ function Movable:resetJump()
|
||||||
self.jump.isJumping = false
|
self.jump.isJumping = false
|
||||||
self.jump.bounceNumber = 0
|
self.jump.bounceNumber = 0
|
||||||
self.jump.stopWhenLanding = false
|
self.jump.stopWhenLanding = false
|
||||||
|
self.jump.lockDir = false
|
||||||
|
|
||||||
self.zspeed = 0
|
self.zspeed = 0
|
||||||
self.motion3D = false
|
self.motion3D = false
|
||||||
|
@ -210,6 +212,7 @@ function Movable:resetJump()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Movable:stopJumping()
|
function Movable:stopJumping()
|
||||||
|
self.z = 0
|
||||||
self.tweens:newTimer(0.01, "jump")
|
self.tweens:newTimer(0.01, "jump")
|
||||||
if (self.jump.stopWhenLanding) then
|
if (self.jump.stopWhenLanding) then
|
||||||
self:resetMotion()
|
self:resetMotion()
|
||||||
|
@ -239,6 +242,7 @@ end
|
||||||
|
|
||||||
function Movable:jumpBack(height, speed)
|
function Movable:jumpBack(height, speed)
|
||||||
self:jumpTo(self.start.x, self.start.y, height, speed, true)
|
self:jumpTo(self.start.x, self.start.y, height, speed, true)
|
||||||
|
self.jump.lockDir = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function Movable:getJumpMotion()
|
function Movable:getJumpMotion()
|
||||||
|
|
Loading…
Reference in a new issue