Hello, another question.
What key is "enter" in GLBasic? Spacebar is key 57. e.g.-> IF KEY(57)
Thanks
Enter (or return) has the scan code number 28. At least the normal one, the enter key on the numpad has the number 156.
You can use the keycode tool to get all scan codes you want, just go to tool->keycodes or simply press alt+k.
Sev in the help F1 you have all the relationships for the keys for all platforms...
You can use Scankey, but in the forum a Coleague did a library for the keys, my counsil it's use some variable better then only the number in example.
static key_Space
key_Space=key(57)
if key_Space Do_Something
//This Way it's better when you use a lot of keys in your code, can be difficult rebember all the keys you are using in your program...
STATIC Key_Space = 57
IF KEY(Key_Space) THEN PRINT "WOHOO", 10,10
for games, dont use "hardwired" keys. Uses with variable (as Schranz0r shown), so users can remap eventuelly later.
A typical "bug" is when the Z key is used for jump, but then German users cant uses that (due Z and Y are swapped)...
Here is the code im often uses to find keys (such as space, shift, pause etc):
// inkey key
LOCAL INKEYED=-1
IF INKEYED=-1
IF INKEY=0
FOR i=1 TO 255
IF KEY(i)
INKEY=i
BREAK
ENDIF
NEXT
ELSE
LOCAL ok=0
FOR i=1 TO 255
ok=ok+KEY(i)
IF ok>0 THEN BREAK
NEXT
IF ok=0 THEN INKEY=0
ENDIF
ELSE
INKEY=INKEYED
ENDIF
nice little code :)