My problem with multiple collision detection (Java)
Discuss My problem with multiple collision detection (Java) in the Game Development forum on Dev Shed. My problem with multiple collision detection (Java) Game Development forum covering non language specific programming - game creation, design, modding, theories and math. A place for developers and gamers of all levels to discuss and debate all things involved in game creation and modding.
Posts: 116
Time spent in forums: 1 Day 7 h 2 m 45 sec
Reputation Power: 7
My problem with multiple collision detection (Java)
Hello,
i don't know how to explain my problem so i've called it:
"my problem with multiple collision detection".
The idea:
you are a guy/girl and need kill all evil aliens.
But the problem is how i know when that guy / girl shoots an alien.
so with other words how do i know when there is a collision between a bullet and an alien.Let's say that there are 50 aliens
and you have unlimited bullets.
When you make a game like pong it's easy because you only have 3 objects.
Do i need to write this like 70000000000 times?
Code:
bullet[0].intersects(evilAlienNR1);
I hope not
Help me java-game-programmers you guys are my only hope
Posts: 5,817
Time spent in forums: 3 Months 4 Days 12 h 16 m 39 sec
Reputation Power: 3460
Ok. Your aliens. Do you have 50 different instances of alien or do you have them in an array or a list? If they're in a list (or array) then you can loop through them for each bullet using a nested loop.