I have a code which looks like this:
/*Need help here*/
if (car1.hitbox.Intersects(parkingLoot[0].hitbox) || car1.hitbox.Intersects(parkingLoot[1].hitbox))
intersects = true;
else
intersects = false;
where hitboxes
are a Rectangle.
As you see there is 2 parkingLoot
object in array and i checked them. But if i had 1000 parkingLoot
objects?
I dont want to use "for loop" to check every parkingLoot
objects hitbox
if intersects with car.
How to detect if car1.hitbox
intersects with ANY HITBOX
OF ANY OBJECT WHICH IS A PARKINGLOOT
OBJECT