Hey guys, I'm having a problem with duplicating a "laser"MC in a simple shooting scenario. If I have one laser shooting from the middle of my ship, it's fine, but if I try to have two lasers, one from each of the wings, only the second one fires. Here's the code I'm using. Any ideas?
on (press) {
ship._x = getProperty(_root.ship, _x);
ship._y = getProperty(_root.ship, _y);
duplicateMovieClip (_root.laser, "laser"+n, n);
setProperty ("laser"+n, _x, ship._x+20);
setProperty ("laser"+n, _y, ship._y);
n++;
duplicateMovieClip (_root.laserb, "laser"+i, i);
setProperty ("laser"+i, _x, ship._x-20);
setProperty ("laser"+i, _y, ship._y);
i++;
}
This is attached to a button I have in the main movie, which only shoots "laserb"'s duplicates.
Whereas, if I remove the second laser script("laserb" duplicateMovieClip), it shoots "laser" correctly. Any help is always appreciated.
Thanks,
Adam
on (press) {
ship._x = getProperty(_root.ship, _x);
ship._y = getProperty(_root.ship, _y);
duplicateMovieClip (_root.laser, "laser"+n, n);
setProperty ("laser"+n, _x, ship._x+20);
setProperty ("laser"+n, _y, ship._y);
n++;
duplicateMovieClip (_root.laserb, "laser"+i, i);
setProperty ("laser"+i, _x, ship._x-20);
setProperty ("laser"+i, _y, ship._y);
i++;
}
This is attached to a button I have in the main movie, which only shoots "laserb"'s duplicates.
Whereas, if I remove the second laser script("laserb" duplicateMovieClip), it shoots "laser" correctly. Any help is always appreciated.
Thanks,
Adam