Hardware Reference
In-Depth Information
You will create the wall using MinecraftShape in the minecraftstuff module,
which you learned about when you created the Alien Invasion in Adventure 8.
Update the theWall() function to create the wall obstacle by following these steps:
1. Find the function in the code you wrote earlier by looking for the following code:
def theWall(arenaPos, wallZPos):
pass
Delete the pass statement that is indented under the function.
2. Indented under the def theWall(arenaPos, wallZPos): line, create a
connection to Minecraft:
mc = minecraft.Minecraft.create()
3. he theWall() function expects two parameters to be passed to it: arenaPos
(the position of the arena); and wallZPos (the Z position along the arena where
the wall will be placed). Using these two parameters, create the position for the
wall (see Figure 9-5):
wallPos = minecraft.Vec3(arenaPos.x, arenaPos.y + 1,
arenaPos.z + wallZPos)
FIGURE.9-5 Create the position of the wall.
4. You will now create the shape blocks that will make up the wall by using two for
loops—one that creates the blocks across the arena (x) and one that creates the
blocks upwards (y)—and adding them to the wallBlocks list:
Search WWH ::




Custom Search