I currently have a file that pulls out instances of a movieclip from the library and has them move across the screen. It names them “mc1” , “mc2” , etc, and the number is controlled by a variable. I also an on click event which attaches a movieclip to the stage in the same manner. this clip then moves down the stage. Each time the user clicks, it checks that there are less than the max of that movieclip, and if so it then sends down another instance. I want these movieclips to be able to hitTest with any of the “mc1” , “mc2” etc, but i can’t seem to get it right. Also, i want it to reset the variable, b, which is used to name the movie clip the moves down the stage.
This is how i attach the bomb movieclip.
if (b<=bombs) {
attachMovie("bomb", "bomb"+b, (i+b));
bomb = _root["bomb"+b];
b += 1;
Now, how can I make each bomb able to hitTest with any of the “mc1”, “mc2” etc that it may encounter, and what is a good way to reset b so that i keep the instance names “bomb1” , “bomb2” etc. I thought of just using a hitTest for each bomb instance, but I wanted to be able to add bombs at a later point if i wanted by simply changing the bombs variable.
I know I can do that, but I would have to add and if(hitTest) statement for each instance of the sub or bomb, depending on which I put the code on. I think I’ll be fine I guess if I limit the number of bombs to a semi-low number, such as 5 or 6, and just add a hitTest onto the mc1 for each of the bombs. Perhaps,
mc.onEnterFrame = function () {
if (this.hitTest(bomb1)){
//actions to perform
}
}
And repeat for each bomb instance, considering I’ll have more mc’s than bombs.
why on earth a game related topic winds up in f8 or as1/2 I don’t know
well I do but I am pretending you will actually get a reply to such a basic question[/quote]
Hmm, perhaps it has something to do with the fact that I’m not asking for help to make a game, I’m asking for help on one small bit of actionscript. And if you’re so smart, I’d like to see your answer to the question. I’m not stupid, I can work a simple hitTest. I was simply asking if there was a way to include all the movie instance of the same name with different ending without adding a seperate hitTest for each. Instead of being arrogant, you should be helpful.