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:
bizcochito
2022-01-18 16:49:49 +01:00
parent 389eaed285
commit 58b4e16251
2 changed files with 27 additions and 15 deletions

View File

@@ -1,9 +1,21 @@
keybind = {}
keybind.moveLeft = "left"
keybind.moveRight = "right"
keybind.moveUp = "up"
keybind.moveDown = "down"
keybind.moveJump = "z"
keybind.moveAttack = "x"
keybind.moveDash = "c"
function keybind:Check(key)
for _, keyname in pairs(key) do
if type(keyname) == "string" then
if love.keyboard.isDown(keyname) then return true end
else
if love.mouse.isDown(keyname) then return true end
end
end
return false
end
keybind.moveLeft = {"left", "a"}
keybind.moveRight = {"right", "d"}
keybind.moveUp = {"up", "w"}
keybind.moveDown = {"down", "s"}
keybind.moveJump = {"z", "space"}
keybind.moveAttack = {"x", 1}
keybind.moveDash = {"c", 2}