user defined keys

BlitzMax Forums/BlitzMax Beginners Area/user defined keys

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Edit: Wait, think I got the wrong end of the stick. Sorry.

if you have a look at the help for keydown and keyhit, there are specific key codes for each key. the up key is KEY_UP, so
 If KeyDown(KEY_UP) Then DrawText "up",10,10

will work. To assign user specified keys you can use an array like:
local playerOneKeys[]=[KEY_UP,KEY_DOWN,KEY_LEFT,KEY_RIGHT,KEY_ENTER]

if keydown(playerOneKeys[0])
debuglog "player has pressed their up key."
endif

Then you can change it easily by going:
playerOneKeys[4]=KEY_F

which will change the player's first key from ENTER to F

That what you were thinking of?