I’ve made a game where you have to avoid bouncing cubes. I have a CreateCube class which is run by a document class and i’m trying to remove all cubes before placing new ones for a new game. The function in the document class seems to remove them but they apparently just become invisible as they still active my hitTestObject function in the CreateCube class.
At the moment in the document class i have this to remove the cubes:-
for(var j:Number = 0; j < cubeContainer.numChildren; j++)
{
trace(cubeContainer.numChildren);
cubeContainer.removeChild(cubeContainer.getChildAt(j));
trace(cubeContainer.numChildren);
}
The game starts with 1 cube so it traces a 1, then a 0 from this for loop.
The cubes are being added to the cubeContainer movieclip which is created in the document class.
Can anyone shed some light on what’s going on here cause at the moment, every time i start a new game my main character dies from invisible cubes
Thanks in advance,
Rich