Hello guys like always I’m trying to run the series about gdevelop5 and the next chapter is the spring jump.
Now there’s a problem in the code that I can’t fix.
the player colliding with spring must fly and in this case the starting animation works.
But after the second frame the animation of the sprite “spring” remains fixed on the same while I want it to return to that base how can I do to solve? Thank you all for any answers.
If youre animation is stoped in a frame loop it
maybe it’s because the animation end in the last frame, so you can add a new action:
Modify the current frame of animation do = 0 to frame of your spring
Have you tried setting two different animations for when the player is in collision with the spring and when it is not?
Your event checks only the condition in which it is in collision with the spring. If you set the action to change to animation #1 for the collision condition (assuming that your collision animation is 1), it will be played only till the player is in collision with the spring.
For the second event, set the condition to check when the player is jumping and set the action to change to animation #2 (assuming that the after collision animation is 2).
Here’s my spring code, you can try something like it if you want.
I use a scene variable and timer to control the animations, although I just realized that the variable doesn’t matter much because it stays at 0…it’s the timer that helps. At one point, I was trying to use a variable to simulate a timer and forgot to delete that line.
guys despite all your kind answers I couldn’t conclude anything any of you can attach me a screen on how to do?
Thank you so much you’re very kind I despite using gdevelop for a long time when I go on lock I can never solve it.
Now when I can try the code, I thank you and of course I will not fail to mention you in the documentation I’m creating on gdevelop.
if you want this code not to be disclosed anyway for me there’s no problem because I’m both creating a platform game and at the same time creating a series of documentation regarding the creation of a game with gdevelop and then a tutorial about this topic.
I managed to achieve the spring mechanic this way:
I got ideas from: