Customizing keyboard/joypad controls ingame?

0 favourites
  • 3 posts
From the Asset Store
Project File of my C3 Tutorial Customized DropDown List
  • Where can I find a tutorial about customizing keyboard/joypad controls ingame?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I didn't find a tutorial for you, so I made a commented example.

    Here it is.

    I did custom control for only 4 controls (up, right left and down) as it is exactly the same for others and that would have made the code harder to read.

    The thing is cut in 2 layouts. One is for the options, where the user will set the controls. The other one is for the game, but I only put a display in it.

    If you go in the options, click on a text box and then put an input using keyboard or gamepad, it should display in the box. Returning to the Display layout and inputing the same key should display that the key is recognised, and where it came from.

    To use it in a game, I separated 4 functions in the "Display" event sheet. Those 4 functions are respectively called by the 4 inputs, after all the custumization the user did. So if you had movements to map, or jump, everything can be put in there.

    As for the method I used :

    • An array "Control" will store the user settings : Controls.At(ControlDirection,InputMethod) = UserKey
    • the ExecuteKey function handles every input given by the user, and calls the corresponding function if it was a mapped key.

    For more details, the code is commented.

    For even more details, just ask

  • I didn't find a tutorial for you, so I made a commented example.

    Here it is.

    I did custom control for only 4 controls (up, right left and down) as it is exactly the same for others and that would have made the code harder to read.

    The thing is cut in 2 layouts. One is for the options, where the user will set the controls. The other one is for the game, but I only put a display in it.

    If you go in the options, click on a text box and then put an input using keyboard or gamepad, it should display in the box. Returning to the Display layout and inputing the same key should display that the key is recognised, and where it came from.

    To use it in a game, I separated 4 functions in the "Display" event sheet. Those 4 functions are respectively called by the 4 inputs, after all the custumization the user did. So if you had movements to map, or jump, everything can be put in there.

    As for the method I used :

    - An array "Control" will store the user settings : Controls.At(ControlDirection,InputMethod) = UserKey

    - the ExecuteKey function handles every input given by the user, and calls the corresponding function if it was a mapped key.

    For more details, the code is commented.

    For even more details, just ask

    wow thank you!

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