|
-
Well, Bullet is a Class. I think you want to see whether any of your bullets are hitting any of your viruses. There are various strategies for optimizing the collision checking, but the basic strategy is to check each bullet against each virus. To do that, you will need to have all your bullets in an array. You did have a bullets array, but I haven't seen your latest code. If you are putting each Bullet into the bullets array as you create them, then you can iterate over that array.
Code:
for (var j:int = 0; j < bullets.length; j++){
if (bullets[j].hitTestObject(viruses[i].mc)){
virusDie(i);
}
}
Don't forget to remove the bullet from the bullets array when you remove it from the display.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|