Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

bullets List collision with meteors List

$
0
0
hi all , so i understandly fully how i use a for loop to run through a list of meteors to check for collision with the player1 but when it comes to wanting to check meteor list collision with bullet list whats the general jist behind it?

surely you dont do a for loop and check bullet 1 with every meteor?


int bulletIndex = 0;
while (bulletIndex!= bullet.Count)
{
for( i = 0 , i < meteor.count ,i++)
{
if (meteor[i].intersects(bullet[bulletIndex]))
{
change scores , play sound for hitting meteor and remove meteors from list and make invisible?

}

}
bulletIndex++;
)



this is what i was looking at but am i going about it wrong or is there much quicker way? or is this good enough or wont it work and i have missed something?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>