Log In  

How to add extra keys

observing a vertical shooter game PAT Shooter all the default player 1 keys (up, down, left right, z,x) were assigned I was trying to add more keys (for example 'A' for refill rockets).

btn(0),btn(1),btn(2),btn(3),btn(4),btn(5) -> all working as default player 1 keys but now I want to add
btn(6). Can anyone tell me how to do that

P#40056 2017-04-30 06:45 ( Edited 2017-05-01 09:25)

The only way to do this is by using the Player 2's keys.

If you check the BTN() function here: http://pico-8.wikia.com/wiki/Btn

it can accept a player_id as a second parameter.

If you type btn(5,1), it will only recognize the A and Q buttons. However, now you also need to go and change all references of btn(5) to btn(5,0)

However, keep in mind that there are downsides to doing this. You're essentially requiring the player to have "two controllers" in some abstract way.

Alternatively, consider adding "Refill Rockets" as a menu item in the pause menu using this: http://pico-8.wikia.com/wiki/Menuitem

P#40063 2017-04-30 07:24 ( Edited 2017-04-30 11:28)

You may also consider separating long and short button clicks. You have to program it though, Pico8 offers no distinction between long and short button click natively.

Or alternatively simultaneous buttons press, like X+C refill rockets.

P#40064 2017-04-30 09:17 ( Edited 2017-04-30 13:17)

Thanks @bekey & @ElGregos both tricks worked for me

P#40098 2017-05-01 05:25 ( Edited 2017-05-01 09:25)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-20 06:26:31 | 0.013s | Q:13