In the last project, we combine the infinite loop the for loop and if statements to complete a very useful block detector program.
In this project, we will be combining the infinite loop, if statements and many of of Minecraft functions to create a game called “The Floor is Lava”.
In this game, your goal is to stay on the randomly spawned glass blocks for as long as possible. As soon as you touch any other block, you lose!
Let’s start off by adding the shown code into your project. This code will start us off by spawning a few glass blocks above us, and then teleporting us above them using the “setPos” function.
We then have a small delay before starting the game. Feel free to test out this code to make sure it’s all working.