Implementing custom keyboard controls

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Cameron Kilgore
:warning: Old Version Published before Godot 3 was released.

I’ve been trying to tackle this issue from a design perspective, and I am not clear if the approach I have in mind is the most efficient given the feature set of other components like InputMap.

The current approach I had in mind was to use various InputEvent tracking to pull the value of the scancode, assign it to a Singleton object, and then listen for that scancode to be thrown in another InputEvent elsewhere in the game.

Does this sound like a scalable solution? When I looked at Input Map, the documentation implied that once its set, its not possible to edit. Also, is there a reason why the scancode value returned in an InputEvent doesn’t match the set constants for the key in @Global?

Just looking for feedback here. Thanks!

InputMap already allow to add, modify and remove actions (is what the editor do), there is a official demo about input mapping you can check.

eons | 2017-06-14 01:32

:bust_in_silhouette: Reply From: Omicron

I am not sure why you want to check scancodes, for hard coded binding ?
Check this part for setting a default mapping : http://docs.godotengine.org/en/stable/learning/step_by_step/simple_2d_game.html#input-actions-setup

And you can edit InputMap programmatically : InputMap — Godot Engine (stable) documentation in English