-eXpl0it3r: I will try to elaborate on this in as few words as possible. Say I have 10 enemy space ship variants to fight. A blue one, yellow one, red one, etc. I set them up such as enemyblue[30]. That way i can make multiple renders of the blue ship sprite if I need to. The ships need to be able to fight so I set up lasers for them. Then say I do the same 10 variants for ally ships. since the hitbox detection requires that I compare two boxes (opposed to how I would like it to check for any boxes) I have to write for loops for
player vs enemyblue[]
player vs enemyyellow[]
...
...
then allyblue[] vs enemyblue[]
allyblue[] vs enemyyellow[]
...
As you can see, the amount of loops I will have to code will grow exponentially with the amount of player/enemy/ally variants I create. I think a solution to this would be to allow an entities hitbox to be checked for intersections with any other hit boxes, rather than specific hitboxes.
This very well may not be possible, but I figured I would try to inquire if there was a way to do this with SFML. The abstract way I imagine this would work would be say: grid 1,1 contains hitboxes a,b,c. Then The program is told to check for hitbox intersections for the hitbox "a", which is located at 1,1, it would see that b,c, also occupy that grid spot and sends back 2 collision data.
Thanks for any help, I'm a new to programming and everything I know if self taught. So sorry for unintentional ambiguity.
-zsbzsb: My plan was to have many different types of enemies (right now, probably a few hundred). I'd set up it up something like thing enemy1[30],enemy2[30] ene.... ...enemy100[30]. (I figure 30 is the max of any enemy I would draw on screen).
Now, say I do the same for an ally variant (ally1[30]...). It seems to me that, I would have to program player laser detection against enemy 1, 2, 3..., Then ally 1 laser detection against enemy 1,2,3,4 and then ally 2 against all possible enemies. Then I would have to program each variant of enemy's laser hit detection against the player and all all ally variants.
I'm not statistician, but i think that would be an exponential number of for loops to write. It seems like there has to be an easier way, which I thought might be in the ability to detect any intersections of hitboxes, not just checking for two specific hitboxes. But maybe I'm just wishfully thinking.