- Now Up and Jump can be defined as different keys/buttons.

This commit is contained in:
2023-01-21 14:29:50 +01:00
parent 33af343c80
commit 3898289f57
3 changed files with 20 additions and 2 deletions

View File

@@ -87,7 +87,7 @@ function abad_state_normal()
elseif btn(keyLeft) or pad(btnLeft) then
abad.update=abad_state_walking
abad.flip=true
elseif btn(keyUp) or pad(btnUp) then
elseif btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=false
@@ -185,7 +185,7 @@ function abad_state_walking()
abad_make_safe()
if btn(keyUp) or pad(btnUp) then
if btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=true

View File

@@ -436,6 +436,14 @@ function update_menu()
setconf("keyright", keyRight)
end
elseif menu_count==4 then
text("PULSA TECLA PER A BOTAR", 20, 24, 13)
local key = btnp();
if key ~= 0 and key~=KEY_ESCAPE then
menu_count = 5
keyJump=key
setconf("keyjump", keyJump)
end
elseif menu_count==5 then
text("PULSA TECLA PER A DISPAR", 18, 24, 13)
local key = btnp();
if key ~= 0 and key~=KEY_ESCAPE then
@@ -483,6 +491,14 @@ function update_menu()
setconf("btnright", btnRight)
end
elseif menu_count==4 then
text("PULSA BOTÓ PER A BOTAR", 22, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 5
btnJump=btn
setconf("btnjump", btnJump)
end
elseif menu_count==5 then
text("PULSA BOTÓ PER A DISPAR", 20, 24, 13)
local btn = padp();
if btn ~= -1 then

View File

@@ -29,12 +29,14 @@ function _init()
keyDown = tonumber(getconf("keydown")) or KEY_DOWN
keyLeft = tonumber(getconf("keyleft")) or KEY_LEFT
keyRight = tonumber(getconf("keyright")) or KEY_RIGHT
keyJump = tonumber(getconf("keyjump")) or KEY_UP
keyShoot = tonumber(getconf("keyshoot")) or KEY_SPACE
btnUp = tonumber(getconf("btnup")) or BTN_UP
btnDown = tonumber(getconf("btndown")) or BTN_DOWN
btnLeft = tonumber(getconf("btnleft")) or BTN_LEFT
btnRight = tonumber(getconf("btnright")) or BTN_RIGHT
btnJump = tonumber(getconf("btnjump")) or BTN_UP
btnShoot = tonumber(getconf("btnshoot")) or BTN_A
--game_init()