Skip to content

Instantly share code, notes, and snippets.

@codeBelt
Last active December 31, 2015 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeBelt/7950815 to your computer and use it in GitHub Desktop.
Save codeBelt/7950815 to your computer and use it in GitHub Desktop.
Grid layout loop.
for(var col:number = 0; col < this.NUM_COLUMNS; col++) {
for(var row:number = 0; row < this.NUM_ROWS; row++) {
console.log("col", col, "row", row);
}
}
var numGamePiece:number = this.NUM_COLUMNS * this.NUM_ROWS;
var item:createjs.DisplayObject;
for (var i:number = 0; i < numGamePiece; i++)
{
item = ImageFactory.getRandomGamePiece();
item.x = (i % this.NUM_COLUMNS) * (this.gamePieceWidth + this.H_SPACE);
item.y = Math.floor(i / this.NUM_COLUMNS) * (this.gamePieceHeight + this.V_SPACE);
item.scaleX = item.scaleY = scaleX;
this._gamePiecesList.push(item);
contianer.addChild(item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment