Configurable controls?

How could I make in-game configurable controls? I’d like to have it in my game so player won’t be forced to use my controls as controls that are convenient for me might not be convenient for someone else (example: Someone might like to use CTRL to fire instead of space as I prefer).

I’d like to support both keyboard and joysticks.

Saving is not an issue, only getting keys, can someone help?

This is a very good idea. ^^

This isn’t an idea, this is question how to achieve it, but thanks :slight_smile:.

Ask for that is a very good idea, I think he means. I think this is an excellent question too (I can’t get it to work yet), would be great if we could do it.

Ah, I see.

You can store the keys codes in variables, and then uses the “Key is pressed ( Text expression )” condition which takes a string as argument, like this:

Key VariableString(UpKey) is pressed

if we consider that the key code to go up is stored in variable UpKey.
The key code are strings like “RControl”, “Return”, “Space”, “a”, “b”, they are identical to the “Key is pressed” condition usually used.

For now there is no way to get the string representing the latest key pressed ( It would be handy to offer the player to use any key he want for any action ), but you could offer to the player the choice between 2/3 different keys for each actions.

Using that then you can make any key work. I included a (very basic) example of how you can use any entered letter for move right. This could be adapted to all keys.

On the scene:

  1. Press a key to start the scene (why is this?)

  2. Enter the letter you want for moving right

  3. Press the letter you entered and watch the pink shape move right.
    VeryBasicExample.gdg (11.1 KB)