i have created a game in which the user controls a object which moves across the bottom of the screen firing bullets at fish which randomly swim across the screen. My problem however is thatwhen the timer runs out some of the fish stay on the screen instead of dissapearing, i have tried everything to make them all go away but i always end up with one or two which stay stuck and remain there no matter what the user does.
My code for the balloons movin n dissapearing is as follows:
function moveBalloons() {
// loop through balloons in array
for(i=balloons.length-1;i>=0;i–) {
// get speed and clip
dx = balloons*.d;
balloon = _root[balloons*.clip];
// move balloon
balloon._x += dx;
// balloon exit left
if ((dx < 0) and (balloon._x < 10)) {
balloon.removeMovieClip();
balloons.splice(i,1);
// balloon exit right
} else if ((dx > 0) and (balloon._x > 160)) {
balloon.removeMovieClip();
balloons.splice(i,1);
}
}
// see whether all balloons gone
if ((nextBalloon >= numBalloons) or (time == 0)) {
balloon.removeMovieClip();
balloons.splice(i);
gotoAndPlay(“game over”);
}
}
please help!!