Log In  

I'm currently working on a game that requires ~10 different buttons. As it stands, I'm using all of the inputs from controller 1 (Up,Down,Left,Right,O,X,Pause) aswell as a few inputs from controller 2 (O,X)

This game will be exported to HTML5 to be played in browser, and I was wondering if there was any way to modify the exported js/html files to allow me to rebind player 1's O/X to be Q and W, and player 2's O/X to be O and P.

This would also mean I would need to rebind the pause button to ONLY be Enter instead of being both Enter and P.
(I use the Enter key as an input in my game by using poke to disable the pause menu)

If anyone knows of a solution please let me know, it would be greatly appreciated!

PS: If remapping the pause button isn't possible then I can work around that, I just need the ability to rebind the main controls :)

P#91131 2021-04-26 17:00 ( Edited 2021-04-26 17:10)

I think there are HTML templates (shared on this BBS and/or github) with custom controls. I’m not sure you can remap the keys, but at least you can catch any key event in javascript and send custom keys to the pico8 canvas.

P#91159 2021-04-26 22:09

where you able to figure this out? i'd love to have my custom keymapping exported to whatever i'm exporting to (bin or html)

P#127824 2023-03-30 08:05

@HannesRoets I ended up using STAT(28, scancode) to check whether or not a keyboard key is being pressed and then made my own key_pressed and key_released functions from there.

https://pico-8.fandom.com/wiki/Stat

P#127828 2023-03-30 11:19 ( Edited 2023-03-30 11:21)
1

Wow, that helped a lot!
Thanks for pointing me in the right direction.

I've made a little cart to show this in action.
p1: up,down,left,right,backspace,r shift, r control and enter
p2: e,d,s,f,l alt, l shift, l control and tab

the only downside is this is just btn() not btnp()

Cart #customkeys2-0 | 2023-03-30 | Code ▽ | Embed ▽ | No License
1

P#127884 2023-03-30 21:51 ( Edited 2023-03-30 22:07)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 16:42:06 | 0.037s | Q:21