Some info: I'm extremely inexpierenced in the game dev world and i only just figured out a haxy way to make and draw a tile map platformer. My current 'collision detection' is literally just having player only add x_speed to xpixelposition if Main.map.getMapArray[ytile][xtile+ 1] is greater then 2(cos 0 1 2 are all unwalkable). The same thing goes for projectile.
basically how would i check if if ANY npc was colliding with ANY bullet? that would take way to long with my current method, yet i always see people doing collision detection like this, hell even mario did this without trouble.
The way im doing it now is something like:
Projectile bullet = new Projectile;
then in bullet I would have something like
so i have a feeling that that would be EXTREMELY inefecient. If i had all 20 bullets on screen, they would EACH check if they were colliding with ANY npc every time they moved at all(so that's 20 loops each containing 20 loops plus the player updating and the map updating and the npc updating and the drawing all that stuff). but idk how im supposed to do it if i cant do that..
Like I said I'm very new to this, in fact I only really got into this on monday when I was informed that I signed up to make a game for my senior project. Up until now the only ideas I've been able to get are ones that I think of during calculus and write down before i forget, it's a miracle I made it this far.