I haven’t used GDev for long but I’m really happy with it. I’ve tried to work with CollisionObjects for melee attacks (following the How To Add Melee Beat’em Up Combat tutorial), but it seems I’m a little dense for not getting what I want out of it.
In the video, I can clearly see the enemy only being hit once then stopping. I want to do the exact same thing, but when I hit the enemy, it just keeps bouncing back until it’s off-screen.
This are all the events I’ve done for this. The rest is made just like in the tutorial:
Did you add this part? If you did and it’s not working there could be a problem with the actual collision object.
The reason adding a permanent force works is because there’s also an event block that removes the forces. If that doesn’t exist, then the enemy will just permanently be knocked back.
Oof, no I have not. I tried I might get away with it without giving the enemy another animation.
I’ve tried it, and yes, now it does bounce off once. But now I have another problem. Once it bounces off it doesn’t stay on the floor, it falls through the screen. Man this is really racking my brains.
I mean if I were you I would just follow the video to a T. Once you have implemented everything and all works as it should, that is the time to start experimenting and changing things up. Are the animations used in the video free on the asset store?
Seems like all I had to do was to just remove the “Hit” animation, and have the “Stop all forces” action only trigger when the object is on the floor. Guess I was onto something when I said I wanted to get away without using extra animations.
Thanks again, and from now on I better watch them tutorials until the end!