Closed berithpy closed 6 years ago
This is due to the gamepad keymaps having both controller and keyboard inputs in the same array. The Gamepad
class checks each array of either buttons or keyboard keys in the keymap, and tries to check if either the keyboard or the controller are pressing any of the keys contained in the array.
Phaser.Keyboard.ENTER
has the code 13
assigned to it. One of the controller button identifiers is also using code 13
. As such, when the ENTER
key is pressed the gamepad is registering that both the correct input is being pressed, as well as the input that contains the controller button with the same code.
Splitting the array for each action (UP, DOWN, LEFT, RIGHT, ACTION) into an object with two arrays (one for the keyboard, one for controllers) and using the corresponding Phaser input function for each should fix this problem.
It does make the keymap format more convoluted however. :-1:
Since keyboard controls are more for debug purposes than to actually play the game, should we just change the buttons to letters?
I disagree that they're only for debug. We'd be excluding a lot of people only supporting controllers officially.
I do agree that changing the binds would be an instant fix for now.
Since keymaps overlap eachother we should probably implement a keymap selector in a menu or something similar, that way we stop bidning multiple keys/kind of keys to multiple actions, i feel like the gamepad logic is well suited for something like this
You mean like selecting input type between keyboard/controller? That sounds good!
between pads too! since we've been having trouble with the generic gamepads and the ps4 one
Changed Keyboard controls to wasdqe and ijkluo for now!
I'll open a new issue for the gamepad menu.
For some reason both players share the action key. Enter and Space