Made keybind editing "backend"

This commit is contained in:
bizcochito
2022-01-18 20:47:55 +01:00
parent 58b4e16251
commit da8b9004b4
2 changed files with 45 additions and 18 deletions

View File

@@ -73,16 +73,16 @@ function Player:Smart()
if math.abs(self.vel.x) < self.zeroSpeed then self.vel.x = 0 end
if keybind:Check(keybind.moveLeft) then
if Keybind:Check(Keybind.move.left) then
self.move_x = -self.moveSpeed
elseif keybind:Check(keybind.moveRight) then
elseif Keybind:Check(Keybind.move.right) then
self.move_x = self.moveSpeed
else
self.move_x = 0
end
self.vel.x = self.vel.x
if keybind:Check(keybind.moveJump) then
if Keybind:Check(Keybind.move.jump) then
if self.isOnGround then
self.vel.y = -self.jumpImpulse
end
@@ -90,18 +90,18 @@ function Player:Smart()
end
self.dashCooldownTimer = math.max(0,self.dashCooldownTimer - current_dt)
if keybind:Check(keybind.moveDash) then
if Keybind:Check(Keybind.move.dash) then
if self.dashCooldownTimer == 0
and not self.isDashing
and self.dashCount > 0 then
self.dashCount = self.dashCount - 1
self.isDashing = true
local vertical = 0
if keybind:Check(keybind.moveDown) then vertical = vertical + 1 end
if keybind:Check(keybind.moveUp) then vertical = vertical - 1 end
if Keybind:Check(Keybind.move.down) then vertical = vertical + 1 end
if Keybind:Check(Keybind.move.up) then vertical = vertical - 1 end
local horizontal = 0
if keybind:Check(keybind.moveRight) then horizontal = horizontal + 1 end
if keybind:Check(keybind.moveLeft) then horizontal = horizontal - 1 end
if Keybind:Check(Keybind.move.right) then horizontal = horizontal + 1 end
if Keybind:Check(Keybind.move.left) then horizontal = horizontal - 1 end
if horizontal == 0 and vertical == 0 then
horizontal = self.sprite_flip.x