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



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


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.


Thanks @bekey & @ElGregos both tricks worked for me



[Please log in to post a comment]