Adjusted menu behvariour with entity and particle movement. adjusted player entity

This commit is contained in:
lustlion
2022-02-03 06:02:06 +01:00
parent 7595ed3b90
commit d4dbc034ea
4 changed files with 25 additions and 21 deletions

View File

@@ -65,27 +65,14 @@
end
function Player:Smart()
-- light
self.light.pos.x = self.pos.x-self.target_offset.x
self.light.pos.y = self.pos.y-self.target_offset.y
self:LightAdjust(-self.target_offset.x,-self.target_offset.y)
if self.dashTimer <= 0 then
if self.isOnGround then
self.vel.x = self.vel.x * (1-self.groundFriction)
else
self.vel.x = self.vel.x * (1-self.airFriction)
end
if math.abs(self.vel.x) < self.zeroSpeed then self.vel.x = 0 end
if Keybind:CheckDown(Keybind.move.left) then
self.move_x = -self.moveSpeed
elseif Keybind:CheckDown(Keybind.move.right) then
self.move_x = self.moveSpeed
else
self.move_x = 0
end
self.vel.x = self.vel.x
if Keybind:CheckDown(Keybind.move.jump) then
if self.coyoteValue > 0 then
@@ -128,6 +115,14 @@ function Player:Smart()
end
function Player:DoPhysics()
if self.dashTimer <= 0 then
if self.isOnGround then
self.vel.x = self.vel.x * (1-self.groundFriction)
else
self.vel.x = self.vel.x * (1-self.airFriction)
end
if math.abs(self.vel.x) < self.zeroSpeed then self.vel.x = 0 end
end
-- reset state
self.isOnGround = false
-- adjust timers
@@ -202,4 +197,5 @@ function Player:HandleAnimation()
if self.dashCount > 0 then
self:Draw(self.mask)
end
self.move_x = 0
end