Dynamic GUI for Re-Mapping Keys in-game

Show us your completed creations made in Construct 2

Post » Fri Apr 18, 2014 3:11 am

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
You do not have the required permissions to view the files attached to this post.
Last edited by zatyka on Fri Jun 20, 2014 7:40 pm, edited 2 times in total.
B
63
S
19
G
8
Posts: 341
Reputation: 12,130

Post » Fri Apr 18, 2014 6:43 am

Thanks :) Looks very useful and time saving.
My first game, Swingy Angie, available now on
Google Play and Opera Store

Let us honor the desire to work, for it is a movable holiday occuring up to three times a year.
B
71
S
23
G
10
Posts: 51
Reputation: 8,887

Post » Fri Jun 20, 2014 2:43 am

@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

Code: Select all
38,Up;
37,Left;
40,Down;
39,Right;
32,Run;


How do you even Load/Save as this format? arrays that i save have all the JSON code at the front.
B
6
S
3
Posts: 39
Reputation: 632

Post » Fri Jun 20, 2014 2:23 pm

@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.
B
63
S
19
G
8
Posts: 341
Reputation: 12,130

Post » Fri Jun 20, 2014 7:10 pm

Nice, very useful :D
B
49
S
15
G
6
Posts: 534
Reputation: 7,195

Post » Sat Jun 21, 2014 2:54 am

Is there any chance you could create a small example of reading/writing an array to that format @zatyka?
B
6
S
3
Posts: 39
Reputation: 632

Post » Mon Jun 23, 2014 5:13 pm

@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).
B
63
S
19
G
8
Posts: 341
Reputation: 12,130

Post » Tue Jun 24, 2014 12:09 pm

Thanks for replying @zatyka.

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

viewtopic.php?f=147&t=108861

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
B
6
S
3
Posts: 39
Reputation: 632

Post » Fri Nov 14, 2014 11:26 am

Hey man,

Thanks for this! Really helpful stuff.
B
8
S
2
Posts: 11
Reputation: 734


Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 21 guests