Hello again
In my first stab at a game I have an array called playerBrickArray holding 28 bricks that are 20x50 pixels.
Currently they are all in a line and I am trying to put them in two lines of 14 from top to bottom of the screen.
I have been trying to use a while loop to say when the arrays Y value is greater than the stage height, set x to -20 and y to the top of the screen again. Unfortunately nothing I have tried so far works. I wonder if you can help.
My code is
//playerBrick starting positions
var playerStartX:Number = 380;
var playerStartY:Number = 50;
public function setPlayerArray (objPlayer:Object, i:Number)
{
playerBrickArray* = objPlayer;
playerBrickArray*.setX(playerStartX);
playerBrickArray*.setY(playerStartY*i);
}
My idea has been various combinations of the following code to be included in the setPlayerArray function above (not sure if thats the right place for it).
while (playerBrickArray*._y > Stage.height)
{
playerBrickArray*._x (playerStartX-20);
playerBrickArray*._y = 0;
}
Trace reveals that all 28 bricks are being made by the array, but only the first row is properly in a line. From the second row onwards they appear on top of each other, and have stopped incrementing by 50.
I’ve included a picture of the problem to help explain it, and a zip of my game so far.
Thanks