code_junkie

Moving objects inside arrays

Nov 14th, 2011
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. Block[,] blocks = new Block[10,20];
  2.  
  3. blocks[x,y+1] = blocks[x,y];
  4.  
  5. blocks[x,y] = null;
  6.  
  7. blocks[x,y+1] = blocks[x,y];
  8.  
  9. blocks[x,y] = null;
  10.  
  11. /* assumes blocks[0] is the bottom row and you build upwards
  12. towards blocks.Count */
  13. List<Block[]> blocks = new List<Block[]>();
  14.  
  15. void EatBottomRow()
  16. {
  17. blocks.RemoveAt(0);
  18. }
Add Comment
Please, Sign In to add comment