I am trying to recreate an old Gameboy game in UE5, namely “Gargoyle’s Quest”. My issue is this: If we press the jump button a second time while the character is still in the air, then he can fly on the same altitude (same z-axis coordinates) for a couple of seconds. After that, he falls down to the ground again. Like shown in the gif below.
I have managed to replicate these mechanics using blueprints (I’m a noob so it wasn’t easy), but there is yet another thing that I need to make him do: while he’s flying, pressing the jump button a third time should cancel the flight and make him fall down. So he’ll either fall down if the timer (delay) runs out, or if we press the jump button. I can’t even begin to think how to make this happen. The blueprint (see below) is rather complicated already, so I don’t know if I need to figure out a different solution from scratch or if there is some solution that I am not aware of. Here is my blueprint:
I am guessing that I need to put something before the Delay node? I’m really at a loss… Any help from more experienced developers would be greatly appreciated! Thank you very much in advance!
He’s jumping: keep it’s altitude AND create a Set Timer by Function ( for example ).
Create a function “Falls Down” that use the code for the character falls down.
If he’s jumping AND keeping the altitude: you can call “Falls Down” and clear the Timer you created. If the player doesn’t press the jump button the Timer will call you function and the character will falls down anyway.
Thank you very much for your reply! What you say makes perfect sense, I just lack the knowledge (still) to understand all of it. I will do some reading based on your suggestions and hopefully I’ll be able to figure it out eventually
The issue now is that I have no idea how to tell it to call the Falls Down function (and clear the timer) when Jump is pressed again… Any ideas on that would be greatly appreciated. Thanks again!
Ι finally figured it out! I had already created a separate input action called “Fly” back when I hadn’t figured out how to set this all up on a single input action (jump). It is practically the same as the “jump” action (digital (bool) type with Space Bar set up as the key value in the IMC. So I just used that one to clear the timer and call the “Falls Down” function
So in case someone else has the same issue, here is my completed blueprint (so far):