So basically, like in most top-down adventure games and RPGs I want the player to bounce away from an attack from an enemy. The enemy should also bounce away from an attack after being hit. How would I accomplish this? I’ve done some research on google but it’s difficult to figure out how to do it. Basically the problem is I don’t know how exactly to calculate this? Like I’m assuming maybe something like the direction the enemy was facing, assuming the enemy was chasing the player, then the player should bounce in that direction when hit. But what if the object is stationary? How would I calculate then? Also I should clarify I’m not using physics simulation, I’m using kinematic and trigger collisions.
edit: Added gif to show what I mean
edit 2: Added a little more info and clarification about what I need help with
edit3: Further clarifaction