I extended the tetrominoes array to include 5 more shapes. They are being drawn properly, but the DrawNext function is having issues accommodating them. What is the best way to code the function so it will use the extended array?
private function DrawNext():void {
if (getChildByName("next")!=null) {
removeChild(getChildByName("next"));
}
var next_t:Sprite=new Sprite();
next_t.x=352;
next_t.name="next";
addChild(next_t);
next_t.graphics.lineStyle(0,0xFFFFFF);
for (var i:uint=0; i<tetrominoes[nextTetromino][0].length; i++) {
for (var j:uint=0; j<tetrominoes[nextTetromino][0][i].length; j++) {
if (tetrominoes[nextTetromino][0][i][j]==1) {
next_t.graphics.beginFill(colors[nextTetromino]);
next_t.graphics.drawRect(tileSize*j,tileSize*i,tileSize,tileSize);
next_t.graphics.endFill();
}
}
}
}
private function BuildTetrominoes():void {
tetrominoes[0]=[[[0,0,0,0],[1,1,1,1],[0,0,0,0],[0,0,0,0]],
[[0,1,0,0],[0,1,0,0],[0,1,0,0],[0,1,0,0]]];
colors[0]=0x00FFFF;
tetrominoes[1]=[[[0,0,0,0],[1,1,1,0],[0,1,0,0],[0,0,0,0]],
[[0,1,0,0],[1,1,0,0],[0,1,0,0],[0,0,0,0]],
[[0,1,0,0],[1,1,1,0],[0,0,0,0],[0,0,0,0]],
[[0,1,0,0],[0,1,1,0],[0,1,0,0],[0,0,0,0]]];
colors[1]=0xAA00FF;
tetrominoes[2]=[[[0,0,0,0],[1,1,1,0],[1,0,0,0],[0,0,0,0]],
[[1,1,0,0],[0,1,0,0],[0,1,0,0],[0,0,0,0]],
[[0,0,1,0],[1,1,1,0],[0,0,0,0],[0,0,0,0]],
[[0,1,0,0],[0,1,0,0],[0,1,1,0],[0,0,0,0]]];
colors[2]=0xFFA500;
tetrominoes[3]=[[[1,0,0,0],[1,1,1,0],[0,0,0,0],[0,0,0,0]],
[[0,1,1,0],[0,1,0,0],[0,1,0,0],[0,0,0,0]],
[[0,0,0,0],[1,1,1,0],[0,0,1,0],[0,0,0,0]],
[[0,1,0,0],[0,1,0,0],[1,1,0,0],[0,0,0,0]]];
colors[3]=0x0000FF;
tetrominoes[4]=[[[0,0,0,0],[1,1,0,0],[0,1,1,0],[0,0,0,0]],
[[0,0,1,0],[0,1,1,0],[0,1,0,0],[0,0,0,0]]];
colors[4]=0xFF0000;
tetrominoes[5]=[[[0,0,0,0],[0,1,1,0],[1,1,0,0],[0,0,0,0]],
[[0,1,0,0],[0,1,1,0],[0,0,1,0],[0,0,0,0]]];
colors[5]=0x00FF00;
tetrominoes[6]=[[[0,1,1,0],[0,1,1,0],[0,0,0,0],[0,0,0,0]]];
colors[6]=0xFFFF00;
tetrominoes[7] = [[[0,1,0,0],[1,1,1,0],[0,1,0,0],[0,0,0,0]]];
colors[7] = 0x00FF80;
tetrominoes[8] = [[[1,1,1,0],[1,0,1,0],[0,0,0,0],[0,0,0,0]],
[[1,1,0,0],[1,0,0,0],[1,1,0,0],[0,0,0,0]],
[[1,0,1,0],[1,1,1,0],[0,0,0,0],[0,0,0,0]],
[[0,0,1,1],[0,0,0,1],[0,0,1,1],[0,0,0,0]]];
colors[8] = 0xFF007F;
tetrominoes[9] = [[[1,1,0,0],[1,0,0,0],[0,0,0,0],[0,0,0,0]],
[[0,0,1,1],[0,0,0,1],[0,0,0,0],[0,0,0,0]],
[[0,0,0,0],[0,0,0,0],[0,0,0,1],[0,0,1,1]],
[[0,0,0,0],[0,0,0,0],[1,0,0,0],[1,1,0,0]]];
colors[9] = 0xFF00FF;
tetrominoes[10] = [[[1,1,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]
[[1,0,0,0],[1,0,0,0],[0,0,0,0],[0,0,0,0]]];
colors[10] = 0x0080FF;
tetrominoes[11] = [[[1,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]];
colors[11] = 0xFF4000;
}