Input_keyboard.js verses input_gamepads.js

It appears that content.gamepads.wasPressed isn’t working where as the content.gamepads.isPressed does work.

The code for the keyboard is slightly different than the gamepads in the use of the ! operator.

return (!!(this._keymap[id]) && !!!(this._lastmap[id]));

return this.current[index].pad.buttons[i].pressed && !this.previous[index].pad.buttons[i].pressed;

Is the ! operator being used correctly in the GAMEPADS case?

That seems correct. It returns true if the the button is pressed this frame but was not pressed last frame. I’ll try and confirm the gamepad code today, but I’m pretty sure it’s working.

Based on a StackOverflow post (, the GAMEPADS::wasPressed may need the !! use.

! is NOT. So !true is false, and !false is true. !0 is true, and !1 is false

Would anyone be able to test the change for me in the Gamepads::wasPressed code?

return !!(this.current[index].pad.buttons[i].pressed) && !!!(this.previous[index].pad.buttons[i].pressed);