Really weird behavior related to inputs. Bug or miss understanding?

0 favourites
  • 3 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Hi, guys. I'm here to share the experience I had recently trying to implement a dynamic input support for keyboard and gamepad. It's probably a stupidity of mine but I need to understand what happened here so I can learn and move on.

    I basically did all the input events in a different event sheet and then I just exposed all the booleans. I'm not doing anything related to inputs outside this event sheet, this is to ensure that I could easily implement all the different inputs from a keyboard and a gamepad without redoing anything, specially outside the input event sheet. So now It's prepared to create, in the options menu, the key assignments by the player.

    I said all that to make you see that It's not something that I'm doing wrong in the character's movement mechanics events. If I use my xbox controller, everything works fine and always did since I started to work from the ground up supporting gamepad and not keyboard. Now that I've implemented the keyboard, and again, nothing changed anywhere because I just expose all the booleans to all routines in the game, a specific movement stopped working.

    Now that you are aware of it, here is the weird behavior:

    This gif shows the weird behavior of the wall jump

    and uses this code

    This gif shows the wall jump working normally

    and uses this code

    or this one

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could you edit your post to make it more clear which gif corresponds to which code? Do I understand correctly that "Keyboard Is key code down+Trigger once" works fine, but "Keyboard On key code pressed" glitches?

    I would start by checking if these two events are triggered in the same tick. Enable both events and add Browser Log "On key pressed" & tickCount and Browser Log "Is key down" & tickCount. Run the game and check browser console.

    Also, because On Key pressed is a trigger, it may be executed at the beginning of the tick, before some other events in your game essential for wall climbing.

  • Could you edit your post to make it more clear which gif corresponds to which code? Do I understand correctly that "Keyboard Is key code down+Trigger once" works fine, but "Keyboard On key code pressed" glitches?

    I would start by checking if these two events are triggered in the same tick. Enable both events and add Browser Log "On key pressed" & tickCount and Browser Log "Is key down" & tickCount. Run the game and check browser console.

    Also, because On Key pressed is a trigger, it may be executed at the beginning of the tick, before some other events in your game essential for wall climbing.

    I edited it. And yes, you understood correctly.

    The trigger behavior is something I din't take in to account. Thanks for the reminder.

    Now that I tested it, I see that both runs at the same tick. I usually use my Input's event sheet as one of the first so I moved it to be the last one and the result is the same and both runs at the same tick.

    Anyways, I moved forward though, I'm even redoing the wall climb/jump mechanic to be more friendly but, yet, I just wanted to understand what is happening. ^^

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