I’m having trouble figuring out how to do this, when the player is on the ground and presses the jump button, the player jumps, how would I go about making variables so that when the player holds left or right and presses jump the player jumps in that direction without having any movement control in the air, basically a simulation of holding down either left or right whilst in the air, my best attempt is something like this setup in the image below, even though it does not work correctly, but I guess it is something like that?
Something like this may do the trick:
When the character isn’t jumping nor falling, the controls work just as intended.
When you are in air, the default controls don’t work, and all depends on the variable Dir of the Char object.
If the last key before the jump was a right, then the character goes right, no way to change it. The same for the left key.
To be safe, if the keys aren’t pressed close enough in time (0.05 secs) then the Char just jumps up.
I hope this helps.
Hm, I’m having a bit of trouble getting the variable to trigger, my guess is I have a conflict that cancels it out, or I have placed events in the wrong order, do you have any insight in why the Dir variable does not trigger?:
It appears I forgot to actually add an actual object variable, I managed to get it working. Thanks a lot for the help! I learned a lot.