Dynamic GUI for Re-Mapping Keys in-game

  • I put together a relatively simple template that gives the player a GUI for re-mapping keyboard controls in-game, and also saves the custom control scheme so it can be loaded the next time the game is played. The GUI is dynamic, so you can add other controls to the template without much effort (see notes in capx). I created it for the upcoming Ludum Dare so players with different keyboard layouts can map controls however they like, but I thought others may find it useful as well.

    Demo

    6-20-14 Edit: A more robust UI for re-mapping keys is available as part of my menu engine:

    https://www.scirra.com/forum/viewtopic.php?f=148&t=103355

  • Thanks Looks very useful and time saving.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • zatyka

    Sorry for reviving this old thread but I wanted to ask you how you managed to get the DefaultControls.txt array looking so neat

    Specifically it looks like this

    38,Up;
    37,Left;
    40,Down;
    39,Right;
    32,Run;[/code:2b97tpo2]
    
    How do you even Load/Save as this format? arrays that i save have all the JSON code at the front.
  • serpent

    It's not in any standard (e.g. JSON) format. I made it up as a way for someone to easily comprehend and amend. The project file is only used for the initial loading of default key mappings. Once that's done, any re-mapping of keys is saved/loaded as a JSON array in webstorage.

    You can always use your own method of formatting data as long as your app knows how to read it. However, it's oftentimes more convenient to use a standardized format.

  • Nice, very useful

  • Is there any chance you could create a small example of reading/writing an array to that format zatyka?

  • serpent

    Ajax can read the project file, and events can populate an array from that format. Events can also read an array, and write a string in that format, but you won't be able to write that string back to the project file. For read/writing external data, you're probably better off using JSON, unless you're exporting with NodeWebkit (which more robust read/write options).

  • Thanks for replying

    i am indeed only using node-webkit, and im slowly learning how to use strings/tokens for array work:

    Ill get there with it, but it will be slow as i get about an hour to myself each night while i am at work

  • Hey man,

    Thanks for this! Really helpful stuff.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)