Hardware Reference
In-Depth Information
To create the circle shown in FigureĀ 7-3, add the following code to the bottom of the
LinesCirclesAndSpheres.py program:
1. First, find the current position of the player by typing the following code:
pos = mc.player.getTilePos()
2. Now draw a circle, starting 20 blocks above the player and with a radius of 20
blocks by typing:
mcdrawing.drawCircle(pos.x, pos.y + 20, pos.z, 20,
block.WOOL.id, 4)
3. Finally, add a time delay so you can see what's happening in the program and you
have the chance to move the player:
time.sleep(5)
4. Save the file and run the program.
FIGURE.7-3 drawCircle creates a circle using a radius around a centre position (x,y,z)
The lines will be drawn again first, you then have five seconds to move the player before
the circle is drawn directly above them.
Search WWH ::




Custom Search