BTN
btn
= "button"
btn( index, [player] )
index | a button number or button symbol (see chart below) |
player | (optional) a player number (0-7) |
If you hold the button down, this will act like it is rapidly pressed.
For multiplayer games, you will need to include player numbers (0-7).
These are the button indexes you can use:
Button | Number | Glyph |
Left | 0 | shift+L |
Right | 1 | shift+R |
Up | 2 | shift+U |
Down | 3 | shift+D |
O | 4 | shift+O |
X | 5 | shift+X |
Button Glyphs
These are the glyphs or symbols that are used inside of the PICO-8 code editor. These button glyphs can actually replace the button numbers when using the btn()
function.
This is what that code will look like inside of PICO-8, with the buttons appearing as glyphs:
Here is what the glyphs look like oustide of PICO-8:
function _update() if btn(⬅️) then x-=1 end --left if btn(➡️) then x+=1 end --right if btn(⬆️) then y-=1 end --up if btn(⬇️) then y+=1 end --down if btn(🅾) then a=true end--o if btn(❎) then b=true end--x end
176
3 Apr 2023