redone controls
you can have any ammount of keys assigned to an acction, only mouse and keyboard supported for now
This commit is contained in:
@@ -73,16 +73,16 @@ function Player:Smart()
|
||||
|
||||
if math.abs(self.vel.x) < self.zeroSpeed then self.vel.x = 0 end
|
||||
|
||||
if love.keyboard.isDown(keybind.moveLeft) then
|
||||
if keybind:Check(keybind.moveLeft) then
|
||||
self.move_x = -self.moveSpeed
|
||||
elseif love.keyboard.isDown(keybind.moveRight) then
|
||||
elseif keybind:Check(keybind.moveRight) then
|
||||
self.move_x = self.moveSpeed
|
||||
else
|
||||
self.move_x = 0
|
||||
end
|
||||
self.vel.x = self.vel.x
|
||||
|
||||
if love.keyboard.isDown(keybind.moveJump) then
|
||||
if keybind:Check(keybind.moveJump) 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 love.keyboard.isDown(keybind.moveDash) then
|
||||
if keybind:Check(keybind.moveDash) 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 love.keyboard.isDown(keybind.moveDown) then vertical = vertical + 1 end
|
||||
if love.keyboard.isDown(keybind.moveUp) then vertical = vertical - 1 end
|
||||
if keybind:Check(keybind.moveDown) then vertical = vertical + 1 end
|
||||
if keybind:Check(keybind.moveUp) then vertical = vertical - 1 end
|
||||
local horizontal = 0
|
||||
if love.keyboard.isDown(keybind.moveRight) then horizontal = horizontal + 1 end
|
||||
if love.keyboard.isDown(keybind.moveLeft) then horizontal = horizontal - 1 end
|
||||
if keybind:Check(keybind.moveRight) then horizontal = horizontal + 1 end
|
||||
if keybind:Check(keybind.moveLeft) then horizontal = horizontal - 1 end
|
||||
|
||||
if horizontal == 0 and vertical == 0 then
|
||||
horizontal = self.sprite_flip.x
|
||||
|
||||
Reference in New Issue
Block a user