I’m working on a paper2d metroidvania style game where the character loads a new level when they walk through a doorway.
I’m encountering some weird behavior when my character walks through the loading zone using keyboard controls.
SCENARIO #1 BUTTON PRESSES: If I have my keyboard controls bound to action mappings (not an axis), then when the level loads and the player spawns in, the blueprint does not detect that the button as being held down. Using the “Input Held Down” function will always return false.
I’ve tried solving this by using a save game slot to store whether the button was held down; however, the problem with this solution is that it cannot detect if I held it down while moving through a loading zone and then released it on the same frame that the level loaded in (which would make my character walk forward without any keys being pressed).
This is a big problem for not just my movement keys, but for other held buttons as well.
SCENARIO #2 AXIS MAPPINGS: If I map left and right on my keyboard to an axis, then I can hold the forward button down to go through doors and continue moving forward after the level loads; however, if I jump through a door, the axis value becomes 0 when I respawn. Conversely, if I do the same thing using a controller instead of a keyboard, it works fine. EDIT: Turns out that this is because pressing the space button on any keyboard will stop the output of other keys, you can try this yourself by opening wordpad, holding down a key (D for instance) and then pressing space button while it is held down - this should stop the D output.
If I can get the “Input Held Down” function to be able to detect buttons that were being held down before the level loaded, then I think all of my issues would be solved. The issue with the axis mappings would also be nice to solve, but it doesn’t solve the problem of buttons that aren’t mapped to axes.