- Home /
Best way to handle melle attacks in a fast paced 2D game
Hello, im working on my melle attacks in my game and ive noticed a few issues, first il point out the basics of how it all works though
first off my player dies in one hit, if it collides with an object tagged "deadly" it dies and respawns, the same are true for my enemies if they collide with an object tagged "fist" which i have following a transform attached to the player animation
The attacks themself propell the player towards the way the punch is directed, if you punch right you dash to the right, if you punch up you dash up
now my game is quite fast paced and my animation frames pretty much make the "fist" box collider active the secind the animation is called, however ive noticed on too many occasions my player is getting hit even after killing the enemy, i should mention when my enemy dies there is no box collider so there is nothing to collide with but the frame is so small that both the player and enemy are dying
So what would be the best way of going about handling melle attacks to ensure if the enemy dies the player cant and if the player dies the enemy cant, someone mentioned trying raycasting to me and another person mentioned changing the execution order, any advice i could get would be much appreciated