Hey everyone!
I've been messing around with picotron, and some people keep saying (including myself) that they hope for more buttons to work with or more input methods, but i've discovered something interesting that anyone can use! (until api changes)
I've made a keyboard tester that is fully commented out, and explains how it works and how get_key works and how to use it. to run the cart, click "show" below and copypaste code into picotron, then run it.
I'll explain some things about get_key here.
There are two forms of get_key. get_key_pressed
and get_key_state
. they are very different and are usefull in their own ways.
get_key_pressed(key)
returns true or false, depending on if key key
is pressed. it returns true
for one frame when key key
is pressed.
get_key_state(key)
returns nil or 1, depending on if key key
is HELD. holding the key will make it return 1, and if key is not held, it returns NIL.
as for what to put in key
, there are rules on what a valid keyname is.
"a"
,"space"
and "ctrl"
are all valid keynames.
"A"
,"`"
and "!"
are NOT valid keynames.
Valid keynames include: lowercase letters; numbers; control keys (space,ctrl,backspace,shift,etc)
INVALID keynames include: uppercase letters; symbols; upper key chars; anything you have to press shift for; F keys; programmable hotkeys.
Interestingly enough, "["
and "]"
are also valid keynames, even though no other symbols seem to work.
If you want to use uppercase letters/symbols, you actually arent out of luck! you can write a script to check if shift is held using get_key_state
, then change what keys do what.
I hope this guide/tutorial/cart was useful to you all! just remember that the API still might change before 0.1, so dont expect this to work later down the line. ill try to update this if it stops working, but dont count on it.
[Please log in to post a comment]