Hi Everyone GNOSTU here.
I was having some trouble coding a sprint animation for my games character, but I seem to be having trouble. I want to the player to double tap the left and right key to enable a sprint animation. I have tried the following code (screenshot below) and it does not seem to be working. I would apricated any help on how to fix or if there is another way to do this.
Thanks in advance.
Graphic Nostalgia Studios.
So I am not clear, do you mean tapping both left/right at the same time, or alternating left/right back and forth? Hope that makes sense
Thanks for the help Gruk.
I am not so great with understanding timers, they are still pretty confusing for me. Is there any way I could get an example of how this should be setup. I’ve checked the Gdevelop tutorials but they just confused me more.
I’m not sure if this is right
Yes, alternating is what I meant
So looking back on your code, I am wondering if the changeplayer variable on the character is not getting to 0,1, or 7. At first I thought maybe the Sprint variable was adding on to itself to go over 2, since you are looking for it to be equal or less than two, but since you are alternating the keys, it should clear back to 0 when the left key is released as long as you don’t have someone with quick fingers, because 1 second is a pretty long time to wait between the key strokes. So, I don’t know if this will help you, but make yourself a text box (call it info, whatever) stick it in your scene and have it display the changeplayer variable, and then make another one (call it info2, whatever) and have it display the sprint variable. See if they are even changing. It could very well be that the 1 second timer is too long a pause state to actually be adding anything (which doesn’t really matter, since you are looking for equal or less than 2 so 0 should work just fine) I am just really sus about the changeplayer variable not changing.
Indeed, you’re not using the timer feature properly.
Most features are explained in the wiki (link at the top), and there’s an example project (or several) for most of them.