PDA

View Full Version : [AS3] Brick placement in break out


butzn1
10-01-2009, 04:45 AM
Im trying to make a breakout game and am having problems placing the bricks

this is the code i have for it so far:
private function createBricks():void {
var x:int = 33;
var y:int = 25;
var newX:int;
var newY:int;
blocks = new Array();
for (var i:int = 0; i < ROWS; i++) {
for (var j:int = 0; j < COLS; j++) {
newX = x + 33;
newY = y + 7;
var b:Bricks = new Bricks(x,y);
x = newX;
y = newY;
blocks.push(b);
addChild(b);
}
}
}

and that just makes a diagonal line of bricks for ever... any suggestions?

rrh
10-01-2009, 05:00 AM
Put some stuff inside the i = 0 to ROWS that's currently inside the j = 0 to COLS