i’m Working on a 2D Platformer and i am struggeling with the hit animation.
I want the Player to get knocked back and play the Hit animation, if he collides with the enemy (Bat)
The Knockbackpart works fine but, it’s either not playing the animation or getting stuck on the last frame.
I’m pretty shure in code 1 where its not playing the hit animation the other animations (Run, Idle, Fall) get triggert because the conditions get fulfillt.
If I trie to adjust the conditions like in code 2 it gets stuck on the last frame of the hit animation and won’t change back to any other animation.
How do i fix it?
Been trying to find a solution for some time now
PS sorry if the solution is super easy I’m pretty new to Gdevelop.
Hello, shiro04 and welcome!
I think to make your knockback work you need to make some small changes to various events.
Change the force to “permanent” here, because your event will only happen on one frame and you need the force being applied more frames to move your character:
You need to change your last subevent so that gonna be a standalone event:
Still about the last event, add the condition “Animation finished” and the action “Stop the object” to remove the permanent force:
I have a suspicion that your hit animation may have the loop checked. If it is, remove it:
I believe that with these changes your knockback will work as long as your Hit animation is playing. Then choose the timing of your “Hit” animation according to your preference.
Thank you a lott !!
The knockback works way better now. The hit animation wasn’t set to loop, but the rest of the changes made it way easier to figure out a solution for the Hit animation i just made it that at the end, the animation changes to jump so it wont be stuck on the last frame of the hit animation.
(my eventsheet now)