On the second iteration of the gameplay loop, you can add more levels to your Minecraft game. You can also take this time to make the arena more unique and personalized, or change the item you make the player break to go on to the next level.
Add some designs to the arena floor. Here, you can see where two //hcyl WorldEdit commands were used to make one hollow cylinder of glass and one of diamond.
Here, you can see the changed arena function.
Take the time to be creative and to make your own design in either the platform or the fences. You might even want to add a ceiling to the arena!
If you add a ceiling, start your player inside the arena. Otherwise, that person will get locked out.
Sometimes, when you’re iterating through the gameplay loop, you don’t want to make a change in one of the sections, such as when your goal is still the same (to break a melon block), so you don’t need to change anything in the Goal section. No problem.
On Iteration 2, you still might want the goal to be to break the melon block, so you don’t have to make any changes to the goal this time around.
Maneuvering around one creeper isn’t too difficult. On Iteration 2, you should add more monsters that the player has to avoid and still break the melon block. By making one small change to the spawn_monster function, you can spawn 5 creepers instead of 1.
This is how the game becomes more challenging with more creepers blocking the melon block.
In Monster Arena, levels are differentiated by which monsters the player faces. To add a second level, the first thing you have to do is create a variable named Level that keeps track of which level the player is on. This variable should start at 1 because the player starts on the first level.
You should also create a list of monsters. Name the list Monsters and add two types of monsters: creepers and zombies.
This shows how to create these two variables in the SetupGame function.
Now that you have a list of monsters to choose from, you can change the spawn_monster function to choose which monsters to spawn, based on the level the player is on. Check out how to choose the correct item from the list.
Finally, you have to increase the level variable every time the player breaks the melon block. If the player reaches the final level (which is now Level 2), notify her that the game is finished; otherwise, the game should reset, but with the new monsters.
This shows the changes to on_block_break that need to happen to start the new level.
After you have added the changes to the spawn_Monster function, test your mod. When you start the test, you should see five creepers.
If you break the melon block, the game resets and you see five zombies.
If you break the melon block again, the game doesn’t change, but you see the message Yay! You beat all of the levels! Good Job!.