All pastes #2058216 Raw Edit

Someone

public text v1 · immutable
#2058216 ·published 2011-05-13 13:38 UTC
rendered paste body
// Draws the checkerboard
function drawBoard():void {
 var currColor:uint;
 var spaceX:int;
 var spaceY:int;
 
 // loop through x and y coordinates of board
 for (spaceX = 0; spaceX < 8; spaceX++){
  for (spaceY = 0; spaceY < 8; spaceY++){
  
   // alternate colors using modulous
   currColor = (spaceX%2 != spaceY%2) ? player1Color : player2Color;
   
   // draw square in graphics object

   // this will be drawn in the current timeline
   graphics.beginFill(currColor);
   graphics.drawRect(spaceX*spaceSize, spaceY*spaceSize, spaceSize, spaceSize);
   graphics.endFill();
  }
 }
}