Log In  

I want to control my pico game via html element event handlers. Given that, what memory address (pico8_gpio offset) must I poke at if I want to simulate a btn(0) event? Also, what's the offset for simulating additional player actions, say, btn(0,1)? Thanks.

P#46446 2017-11-18 10:25 ( Edited 2017-11-19 00:21)

from the exported html:

// When pico8_buttons is defined, PICO-8 takes each int to be a live bitfield
// representing the state of each player's buttons
var pico8_buttons = [0, 0, 0, 0, 0, 0, 0, 0]; // max 8 players
pico8_buttons[0] = 2 | 16; // example: player 0, RIGHT and O held down
// 1:LEFT, 2:RIGHT, 4:UP, 8:DOWN, 16:1st button (O), 32:2nd button (X)

also you might be interested in this: Gamepad support in browser for PICO-8 by Krajzeg

P#46448 2017-11-18 13:17 ( Edited 2017-11-18 18:22)

Thanks @utrabrite. Exactly what I needed.

P#46454 2017-11-18 19:21 ( Edited 2017-11-19 00:21)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 09:03:51 | 0.041s | Q:13