Key codes question

Discussion and feedback on Construct 2

Post » Sat Oct 04, 2014 6:46 pm

@ashley
hi :) i have a very simple question
my game has rebindable keys... i maped all my keyboard... but sometime depending of the language and configuration it changes and it gives me key codes that i have not seen before.

so, where can i get a list of ALL the key codes numbers and its assigned keys?? so i can cover ALL keyboards possible

im using a system where i enter ALL the numbers into a dictionary and assing a tag with a string identifying wich key has been stroked... so thats why i need the complete list of possible numbers of key codes if its possible.

:)
thanks!!!
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Sun Oct 05, 2014 8:50 am

Surely it shouldn't matter what the key code is? If you're saving the configured key code to a WebStorage value, then all you need to do to recognise it is pull up that same code in the events.

So something like Keyboard: On key code pressed (int(WebStorage.LocalValue("KeyUp")) -> Simulate jump.

In the options screen where the keys are configured, use Keyboard.StringFromKeyCode (int(WebStorage.LocalValue("KeyUp")) to show what key each key code represents (the "Up" button in this case).
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Sun Oct 05, 2014 8:58 am

http://www.cambiaresearch.com/articles/ ... -key-codes

If you press the Q letter for instance, the same keycode will be returned regardless of the type of keyboard, also, you should not expect the user to change his keyboard ingame so he will configure it once I think (the configuration being done using the lastkeycode value to select the key pressed, and the Stringfromkeycode to show it)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Oct 05, 2014 6:17 pm

@GeometriX
@Aphrodite

thanks :)
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Thu May 05, 2016 11:52 am

is there a list anywhere?
- Head of Tall Story Studios.

Creator of GOV, Project Abyss, Spiritlands & more!
B
27
S
12
G
1
Posts: 129
Reputation: 3,064

Post » Thu May 05, 2016 11:53 am

is there a list anywhere?
- Head of Tall Story Studios.

Creator of GOV, Project Abyss, Spiritlands & more!
B
27
S
12
G
1
Posts: 129
Reputation: 3,064


Return to Construct 2 General

Who is online

Users browsing this forum: Lorvin and 4 guests