Game Development Reference
In-Depth Information
for (var c:int = 0; c < board[r].length; c++) {
tempDie = board[r][c];
if (tempDie != null) {
removeDie(tempDie);
}
}
}
}
public function moveDiceDown():void {
var collength:int = DIE_COLS-1;
for (var c:int = collength; c >= 0; c--) {
var rowlength:int = DIE_ROWS-1;
var missing:Number=0;
for (var r:int = rowlength; r >= 0; r--) {
tempDie=board[r][c]
if (tempDie != null) {
//find number of null spots in this column
missing=0;
if (r<DIE_ROWS) {
for (var m:int = r + 1;m < DIE_ROWS;m++) {
if (board[m][c]==null) {
missing++;
}
}
}
if (missing > 0) {
tempDie.row = r+missing;
tempDie.col = c;
board[r+missing][c] = tempDie;
board[r][c] = null;
tempDie.startFalling(tempDie.y+(missing*DIE_HEIGHT)+
(missing*ROW_SPACING),10);
}
}
}
}
}
public function removeClickedDice():void {
removeClickedDiceFromScreen();
moveDiceDown();
clickedDiceArray = new Array();
}
public function removeClickedDiceFromScreen():void {
var dieLength:int = clickedDiceArray.length-1;
while(clickedDiceArray.length > 0) {
tempDie = clickedDiceArray.pop();
removeDie(tempDie);
}
}
private function endGame():void {
cleanUpLevel();
Search WWH ::




Custom Search