Complex Command Inputs (Timer issues)

Hello, I am new to GDEV, so apologies if there’s a simple solution I’ve overlooked.

I am fairly certain this boils down to me not understanding quite how timers and sub-events work, but I’ve looked over a number of threads to tweak this between yesterday and today and I still haven’t quite gotten the behavior I want.

In an effort to keep the input kind of tight, I’ve attempted to give the player two frames (assuming 30 fps) to input down, then 2 more frames after that to input right, then press A. Unfortunately, it seems like the sprite just straight up bypasses all timers and timer deletions: as soon as I run debug, not only does pressing A cause the attack to happen even if I don’t press any directions, it ALSO causes the animation to play repeatedly when the button is held, as if it’s ignoring the “trigger once” option that I have.

What does AT1 measure? Because 0.001 seconds is 30 times faster than your framerate (30fps = 1 frame every 0.0333 seconds)

Instead of using timers, have look at using the current frame number (something like “If the current frame of NewObject = 2”). That way the device speed won’t impact on the attack timings.

AT1 starts a timer for the window for the next input in a sequence to be registered. The goal here was to see if I could recreate a QCF type input commonly found in fighting games and beat-em-ups (i reduced it to just down,forward+button just for testing’s sake). The idea is that if AT1 reaches 0.06 seconds, then the player took too long to perform the QCF input and that closes out the window. Instead, it seems like none of the timers are getting deleted from memory at all, even though they should.

–and it’s as of writing that out that I realize that having it as a sub-event means that it will only delete the timer if down is still being held, huh?
–I thought I had a lightbulb above, but it still doesn’t work. You can still just press the button and have the attack come out without doing any of the motions. :confused:

Current frame stuff is useful if this were an attack string, but this should be a motion that the player can whip out whenever in neutral. You’d pretty much have to use a timer in that regard, right?

It’s being deleted. But when you check on the value of a timer, if that timer doesn’t exist then it will get created by GDevelop.

To overcome this, pause and reset the timer. This will zero it out, and stop it ticking over until it is unpaused

4 Likes

AWESOME. That works. It also helped me stumble on a new problem, but that’s kind of the nature of game-making. :wink:

Thank you very much.