Hardware Reference
In-Depth Information
FIGURE.9-9
Holes appear, and your player must be careful not to fall into one!
As with the river, if the player falls into a hole they are returned to the start of the
arena, but you won't introduce to the code to do that until Part 3 of this adventure.
Now, you're going to update the
theHoles
function to create the holes obstacle:
1.
Find the
theHoles
function, by looking for the following code in the code you
wrote earlier:
def theHoles(arenaPos, holesZPos):
pass
Delete the
pass
statement that is indented under the function.
2.
Indented under the
def theHoles(arenaPos, holesZPos):
line, create a
connection to Minecraft:
mc = minecraft.Minecraft.create()
3.
Create two constants, which are the number of holes that will be created (
HOLES
)
and the width of the holes obstacle (see FigureĀ 9-10):
HOLES = 15
HOLESWIDTH = 3
4.
Create the holes
while
loop, which will continue until it's game over:
while not gameOver: