Howdy partners,

I'm setting up controller support in my local multiplayer game, and I need to be able to add/remove buttons from my input map depending on the controller device id.

I've found the method I need to use: https://docs.godotengine.org/en/stable/classes/class_inputmap.html#class-inputmap-method-action-add-event

However, I can't for the life of me work out how to create an InputEvent for a specific button on a specific device.

For example, can anyone tell me what Device 0, Button 0 would look like as an InputEvent?

Thanks

  • Worked it out, can create an InputEvent like this:

    var thing := InputEventJoypadButton.new()
    thing.device = 0
    thing.button_index = 0

Worked it out, can create an InputEvent like this:

var thing := InputEventJoypadButton.new()
thing.device = 0
thing.button_index = 0

I'm sorry I'm not sure what to make of the flag. Did you mean to select the follow up post as the 'Best Answer'?

I've fixed the code block in the second post and dismissed the flag for now.

    Megalomaniak Apologies, new to the forums and didn't realise that was how you marked a question answered. Cheers