I am new to the forum and in desperate search for help.
The game I am making is kind of like a platformer, so I have a main character in it who moves around and does stuff. The idea is to search for spawning carrots and then eat them.
The first animations (#0, #1, #2) work just fine - they are for idle, running and jumping. I recently added an animation for eating. I made and used it just the same way as the other animations, but when I press the button for eating ingame, the character just disappears (and it won’t come back also).
Now, I thought of different approaches to fix the issue already. But as you can see, I cannot find a way to fix it.
What I tried so far (did not work):
- Change the animation (images)
- Change the animation (#)
- Change the key
So maybe anyone of you could help me.
Thanks in advance!
P.S: I am not really a pro in gdevelop, just doing it for fun and making a small game for my girlfriends little sisters.!
i think maybe you put code so the rabbit or whatever the charcheter is dissapears when you press the carrot key?
Based on you logic when you press return it sets the animation on Pops to 3 at the end of the frame, then at the beginning of the frame it sees that Pops is not moving and sets the animation to 0. And then does this every frame until you release return.
The easiest fix is to put a parent condition over all of the conditions that set the animations based on jumping/moving/running that does not do those things if you are in the eating animation.
The harder fix is develop a state machine for you player object and set the animation based on state… if you don’t know what a state machine is, then just focus on protecting your animations from clobbering each other.
I think I understand what you mean. I am not using any code that makes the character disappear, as far as I know. When I press the “return” key, it immediatly disappears.
Okay, I will try this.
But… since I am a noob at this, can you explain it a little more in detail?
What kind of “parent condition” should I use? Should I only use it for the idle, run and jump animation? I have not really used parenting with sub-conditions yet… so I am unsure how to set it up properly.
Thanks for the advice!
EDIT: So, I tried putting all the animation except for the eating animation into a group. Sadly, it did not change anything. Still disappears. I also tried putting the eating animation into the group aswell, did not work neither.
I just started a completely new project and this time I could not even use a single animation. Just made a platform to walk on, created an animation and used the “if right key is pressed play animation…”. Character immediatly disappeared. I didnt do a single thing other than that in the project. Maybe my Gdevelop is broken. I will try to reinstall.
Hi @ekuew I know this is pretty much medium/advanced but take a look here is an state machine to control the animations of the player, attack, jump, dash, wall jump, wall slide.
That’s some crazy work you have done there! Thanks for that. I will look to implement that sort of thing, if I need it.
I fixed the problem though:
- I had to reinstall Gdevelop
- I made a new project and abandoned the old one
- Slight adjustment in events and creating groups for a better overview
Result: It works! Now, I dont know what exactly made it work, since the behaviour was totally different from before the reinstallation: Before the character disappeared. After reinstalling it did not, just the animation would not play at all and I made these changes in the events. I am still curious what exactly was wrong there… so if you have an idea, please do tell me!