keyboard button fixes
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -3,5 +3,5 @@
|
|||||||
-- desc: Life of a programmer in the Vector
|
-- desc: Life of a programmer in the Vector
|
||||||
-- site: https://github.com/rastasi/mranderson
|
-- site: https://github.com/rastasi/mranderson
|
||||||
-- license: MIT License
|
-- license: MIT License
|
||||||
-- version: 0.13
|
-- version: 0.14
|
||||||
-- script: lua
|
-- script: lua
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
function Input.up() return btnp(0) end
|
-- Gamepad buttons
|
||||||
function Input.down() return btnp(1) end
|
local INPUT_KEY_UP = 0
|
||||||
function Input.left() return btn(2) end
|
local INPUT_KEY_DOWN = 1
|
||||||
function Input.right() return btn(3) end
|
local INPUT_KEY_LEFT = 2
|
||||||
function Input.player_jump() return btnp(4) end
|
local INPUT_KEY_RIGHT = 3
|
||||||
function Input.menu_confirm() return btnp(4) end
|
local INPUT_KEY_A = 4 -- Z key
|
||||||
function Input.player_interact() return btnp(5) end -- B button
|
local INPUT_KEY_B = 5 -- X key
|
||||||
function Input.menu_back() return btnp(7) end
|
local INPUT_KEY_X = 6 -- A key
|
||||||
|
local INPUT_KEY_Y = 7 -- S key
|
||||||
|
|
||||||
|
-- Keyboard keys
|
||||||
|
-- TODO: Find correct key codes for SPACE and LCTRL
|
||||||
|
local INPUT_KEY_SPACE = 48
|
||||||
|
local INPUT_KEY_BACKSPACE = 51
|
||||||
|
local INPUT_KEY_ENTER = 50
|
||||||
|
|
||||||
|
function Input.up() return btnp(INPUT_KEY_UP) end
|
||||||
|
function Input.down() return btnp(INPUT_KEY_DOWN) end
|
||||||
|
function Input.left() return btn(INPUT_KEY_LEFT) end
|
||||||
|
function Input.right() return btn(INPUT_KEY_RIGHT) end
|
||||||
|
function Input.player_jump() return btnp(INPUT_KEY_A) or keyp(INPUT_KEY_SPACE) end
|
||||||
|
function Input.menu_confirm() return btnp(INPUT_KEY_A) or keyp(INPUT_KEY_ENTER) end
|
||||||
|
function Input.player_interact() return btnp(INPUT_KEY_B) or keyp(INPUT_KEY_ENTER) end -- B button
|
||||||
|
function Input.menu_back() return btnp(INPUT_KEY_Y) or keyp(INPUT_KEY_BACKSPACE) end
|
||||||
|
function Input.toggle_popup() return keyp(INPUT_KEY_ENTER) end
|
||||||
|
|||||||
Reference in New Issue
Block a user