Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Ouya Unity Game Development

You're reading from  Ouya Unity Game Development

Product type Book
Published in Oct 2013
Publisher Packt
ISBN-13 9781783559701
Pages 118 pages
Edition 1st Edition
Languages
Author (1):
Gary Riches Gary Riches
Profile icon Gary Riches

Adding extra levels


Now that the game is looking better, we can add some more content in to it. Luckily the jagged array we created earlier easily supports adding more levels. Levels can be any size, even with variable column heights per row. Double-click on the Sokoban script in the Project panel and switch over to MonoDevelop. Find levels array and modify it to be as follows:

  // Create the top array, this will store the level arrays
  int[][][] levels = 
  {
    // Create the level array, this will store the row array
    new int [][] {
    // Create all row array, these will store column data
    new int[] {1,1,1,1,1,1,1,1},
    new int[] {1,0,0,1,0,0,0,1},
    new int[] {1,0,3,3,0,3,0,1},
    new int[] {1,0,0,1,0,1,0,1},
    new int[] {1,0,0,1,3,1,0,1},
    new int[] {1,0,0,2,2,2,2,1},
    new int[] {1,0,0,1,0,4,1,1},
    new int[] {1,1,1,1,1,1,1,1}
  },
  // Create a new level
  new int [][] {
    new int[] {1,1,1,1,0,0,0,0},
    new int[] {1,0,0,1,1,1,1,1},
    new int[] {1,0,2,0...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}