This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 7th, 2013  |  syntax: C#  |  size: 0.90 KB  |  views: 303  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.                 int[] columnMatched = new int[Map.Instance.Layout.Width]; // Create an array with a length equal to our column count
  2.                
  3.                 // Iterate over the blocks the player matched
  4.                 while (selectedBlocks.Count > 0)
  5.                 {
  6.                         Block block = selectedBlocks.Dequeue();
  7.                         columnMatched[block.Position.X]++; // Increase the recorded matches in our column array
  8.                         block.Matched();
  9.                 }
  10.                
  11.                 // Iterate over our column array
  12.                 for (int x = 0; x < columnMatched.Length; x++)
  13.                 {
  14.                        
  15.                         // Create a new block to replace each one matched
  16.                         int newBlockCount = 0;
  17.                         for (int i = 0; i < columnMatched[x]; i++)
  18.                         {
  19.                                 Map.Instance.CreateBlock(new GridPos(x, Map.Instance.Height+newBlockCount)); // Spawn it at visible grid height plus the amount of blocks we've created so far
  20.                                 newBlockCount++;
  21.                         }
  22.                         if (columnMatched[x] > 0) Map.Instance.CollapseColumn(x); // Collapse the column
  23.                        
  24.                         yield return null;
  25.                 }
clone this paste RAW Paste Data