fixed dash timer bad when lag
This commit is contained in:
parent
ce43e48723
commit
e62eae1564
|
@ -16,10 +16,10 @@ function Player:New(x,y)
|
||||||
|
|
||||||
o.jumpImpulse = 3.5 -- gameworld pixels
|
o.jumpImpulse = 3.5 -- gameworld pixels
|
||||||
|
|
||||||
self.wallJumpImpulse = { x = 2.5, y = 3.5 }
|
o.wallJumpImpulse = { x = 2.5, y = 3.5 }
|
||||||
|
|
||||||
o.coyoteAmount = 5 -- int
|
|
||||||
o.coyoteValue = 5 -- frames
|
o.coyoteValue = 5 -- frames
|
||||||
|
o.coyoteAmount = 5 -- int
|
||||||
|
|
||||||
o.dashCooldownTime = 0.1 -- seconds
|
o.dashCooldownTime = 0.1 -- seconds
|
||||||
o.dashCooldownTimer = 0 -- seconds
|
o.dashCooldownTimer = 0 -- seconds
|
||||||
|
@ -151,7 +151,7 @@ function Player:Smart()
|
||||||
|
|
||||||
-- set dash values
|
-- set dash values
|
||||||
self.dashDirection = GetAngleFromVector(horizontal, vertical)
|
self.dashDirection = GetAngleFromVector(horizontal, vertical)
|
||||||
self.dashTimer = self.dashTime
|
self.dashTimer = math.floor(self.dashTime * game.framerate)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- not dashing!
|
-- not dashing!
|
||||||
|
@ -193,7 +193,7 @@ function Player:DoPhysics()
|
||||||
self.isOnGround = false
|
self.isOnGround = false
|
||||||
|
|
||||||
-- adjust timers
|
-- adjust timers
|
||||||
self.dashTimer = self.dashTimer - current_dt
|
self.dashTimer = self.dashTimer - 1
|
||||||
self.noDriftFrames = self.noDriftFrames - 1
|
self.noDriftFrames = self.noDriftFrames - 1
|
||||||
|
|
||||||
-- DASH STATE
|
-- DASH STATE
|
||||||
|
|
3
main.lua
3
main.lua
|
@ -22,7 +22,8 @@ function love.load()
|
||||||
game = {
|
game = {
|
||||||
scale = 2,
|
scale = 2,
|
||||||
width = love.graphics.getWidth(),
|
width = love.graphics.getWidth(),
|
||||||
height = love.graphics.getHeight()
|
height = love.graphics.getHeight(),
|
||||||
|
framerate = 60
|
||||||
}
|
}
|
||||||
|
|
||||||
require "code/require"
|
require "code/require"
|
||||||
|
|
Loading…
Reference in New Issue