Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function eFrame( e:Event ):void
- {
- if ( !paused )
- {
- var amount:int = 0;
- var xPos:Number = 0;
- var yPos:Number = 0;
- gridVector = nextGrid;
- for ( var i:int = gridVector.length - 1; i >= 0; --i )
- {
- amount = amountSurrounding( i );
- xPos = ( i % gridWidth ) * tileWidth + 1;
- yPos = ( i / gridWidth << 0 ) * tileHeight + 1;
- if (amount != 0) {
- trace(amount)
- }
- if ( gridVector[ i ] )
- {
- if ( amount < 2 || amount > 3 )
- { // If underpopulated or overpopulated
- // Die
- nextGrid[ i ] = false;
- rectToFill.x = xPos;
- rectToFill.y = yPos;
- tileCanvasData.fillRect( rectToFill, 0xffffffff );
- } //else continue to live.
- }
- else
- {
- if ( amount == 3 )
- {
- trace( "test" )
- nextGrid[ i ] = true;
- rectToFill.x = xPos;
- rectToFill.y = yPos;
- tileCanvasData.fillRect( rectToFill, 0xff000000 );
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment