123456programmer
Programmer
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.
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.