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.
6-20-14 Edit: A more robust UI for re-mapping keys is available as part of my menu engine:
Thanks Looks very useful and time saving.
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
How do you even Load/Save as this format? arrays that i save have all the JSON code at the front.
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
Develop games in your browser. Powerful, performant & highly capable.
Is there any chance you could create a small example of reading/writing an array to that format zatyka?
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 zatyka.
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
Thanks for this! Really helpful stuff.