I have done several games but actually never a game where you shoot "bullets" at enemies and need to have an effective way to check if an enemy is hit etc. I feel quite clueless as to what is the best method for this or how to go about it.
The first problem is actually how to shoot the actual "bullet" toward the enemy, I am reusing the example I made for the circle aiming behavior where you steer the aim with the left analog stick of the controller in a 360 movement around the player (this movement was actually better and more smooth with the SDL object but in this example I am using the regular xbox gamepad object since I don't think everyone have the SDL object installed)
I looked at another example that used angle and tried to implement that but it seems the aim that I have in my example does not actually have an angle even though it circulates around the player? In my example now the bullet just shoots straight up so it is an epic fail. So the first thing would be how to actually shoot the bullet in the angle toward the aim?
My next thinking though is what is the best method for actually handling the "hit check" on enemies? Is the regular "is bullet overlapping enemy" the way to go or is that really primitive and there are better and more performance friendly ways to do it? The main reason I am asking is that I am making a game where there will be tons of enemies (perhaps in the 100s if possible) so checking overlapps for multiple bullets fired and active on every object and obstacles on every frame might be very performance heavy and the wrong way to go? Also the bullets in my game is planned to go incredible fast (pretty much instant like in real life) so not sure that would also be an issue. Perhaps there are other methods that are better for this sort of thing like drawing a line somehow that calculate a hit when you fire and the line overlaps an enemy? The problem then though also is that if it is a line that goes straight over the frame it should still not hit the enemy if he is behind cover. I am a bit at a loss as to what direction is the best to go with this sort of thing?