Level complete detection
It's all well and good having three levels, but without a mechanism to move between them they are useless. We are going to add a check to see if the player has finished a level, if they have then increment the level counter and load the next level in the array. We only need to do the check at the end of every move; to do so every frame would be redundant.
We'll write the following method first and then explain it:
// If this method returns true then we have finished the level boolhaveFinishedLevel () { // Initialise the counter for how many crates are on goal // tiles int cratesOnGoalTiles = 0; // Loop through all the rows in the current level for (int i = 0; i< levels[currentLevel].Length; i++) { // Get the tile ID for the column and pass it the switch // statement for (int j = 0; j < levels[currentLevel][i].Length; j++) { switch (levels[currentLevel][i][j]) { case 5: // Do we have a match for a crate on goal ...