Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple shooting game, problems with hitTest

Status
Not open for further replies.

123456programmer

Programmer
Aug 3, 2003
105
AU
Hello,
I've been working on a simple shooting game lately.
The structure is quite simple, I have three mc.
One is the gun, one is the enemy, and the last one is the bullet.
With this code on the gun:

onClipEvent (mouseDown) {
i = i+1;
set("bulleti", "bullet"+i);
duplicateMovieClip(_root.bullet, "bulleti", i);
}

Now, here's the problem:
the enemy mc has this:

onClipEvent (enterFrame) {
if (this.hitTest(_root.bullet)) {
this.Play();
}
}

But because each mc that duplicateMovieClip() creats have different instance name, I don't know what to do. I also tried to put this scipt on the bullet mc, but then I have the same problem because there are more than one enemy mc.

thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top