PDA

View Full Version : limiting movieclips (lasers)


DeathTrap
12-20-2002, 05:57 PM
Hello,
I'm quite new to action script, but i think what im doing is quite advanced, but please dont bite my heaed off if it isn't.
What i want to do is make a game with lasers, and i want to limit the number of lasers able to be fired at once, the problem is i create my lasers using a original, and using duplicateMovieClip, and so all the code goes to the original as well, and as this never seems to get deleted, the if statement is run forever...
if (this._y<0 and ) {
this.removeMovieClip();
_root.laserCounter--;
}
this is part of the code for the laser.
I put the variable in a frame code section, as it didd'nt seem to like refering to other movieclips for somereason. It works originaly, until the first laser bearm, which i assume is the original, leaves the screen, then the counter (which i set up to show me what is happening with this variable) just continuously drops into minus figures. I think one way to solve this would be to make it so the original doesnt follow the moving code, but i have no idea how to do this :(
If anyone could help i would greatly apreciate it, thanks
Rob

gwd
12-23-2002, 10:11 PM
if (this._y<0 and ) {
this.removeMovieClip();
_root.laserCounter--;
}

This is syntax wrong!

It should be something like this:

if (this._y<0) {
_root.laserCounter -=1;
this.removeMovieClip();
}

Goodluck!