Download

Attack nearest enemy

Hello everyone!

I was wondering, I have my combat system up and ready to go and does well but I wanna be able to attack the closest person to me in the direction I’m facing, so I don’t attack somebody that comes in for an attack and ends up closer or if I hit my enemy in a field of enemies and start jumping from one enemy to another.

Here is my implementation of finding the closest target in the limited angle

Using vector 2d - gun rotation range X and Y as angle limitations left and right

Thanks, I’ll look into that pathway and test it out to the best I can :grin: