Guest User

Untitled

a guest
Jan 12th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function eFrame( e:Event ):void
  2.         {
  3.            
  4.             if ( !paused )
  5.             {
  6.                 var amount:int = 0;
  7.                 var xPos:Number = 0;
  8.                 var yPos:Number = 0;
  9.                
  10.                 gridVector = nextGrid;
  11.                
  12.                 for ( var i:int = gridVector.length - 1; i >= 0; --i )
  13.                 {
  14.                     amount = amountSurrounding( i );
  15.                     xPos = ( i % gridWidth ) * tileWidth + 1;
  16.                     yPos = ( i / gridWidth << 0 ) * tileHeight + 1;
  17.                     if (amount != 0) {
  18.                         trace(amount)
  19.                     }
  20.                     if ( gridVector[ i ] )
  21.                     {
  22.                        
  23.                         if ( amount < 2 || amount > 3 )
  24.                         { // If underpopulated or overpopulated
  25.                             // Die
  26.                             nextGrid[ i ] = false;
  27.                             rectToFill.x = xPos;
  28.                             rectToFill.y = yPos;
  29.                             tileCanvasData.fillRect( rectToFill, 0xffffffff );
  30.                            
  31.                         } //else continue to live.
  32.                     }
  33.                     else
  34.                     {
  35.                         if ( amount == 3 )
  36.                         {
  37.                             trace( "test" )
  38.                             nextGrid[ i ] = true;
  39.                             rectToFill.x = xPos;
  40.                             rectToFill.y = yPos;
  41.                             tileCanvasData.fillRect( rectToFill, 0xff000000 );
  42.                         }
  43.                     }
  44.                 }
  45.             }
  46.         }
Add Comment
Please, Sign In to add comment