Hardware Reference
In-Depth Information
The lines and circles will be drawn again, giving you five seconds in between to move
the player before the sphere is then drawn.
You can download the complete code for lines, circles and spheres from the Adventures
in Minecraft companion website at www.wiley.com/go/adventuresinminecraft.
Spheres are great for creating explosions in Minecraft. By drawing a sphere of
AIR , you can remove all the blocks around the centre of the sphere, creating a
'hole' in the world.
CHALLENGE
Now that you've seen how simple it is to create basic shapes, try creating
your own 3D art masterpiece in code, using lines, circles and spheres.
Creating a Minecraft Clock
Now that you know how to create circles and lines, you might be able to see how you
would code the clock in Figure  7-1. The face is simply a large circle, and each of the
hands is a line. Now comes the difficult part—working out where to put the lines and
how to make them move.
To see a tutorial on how to create the Minecraft Clock, visit the companion
website at www.wiley.com/go/adventuresinminecraft.
In this part of the adventure, you will use trigonometry to work out where to point
the hands by turning the angle of the hand into the x and y coordinates on the clock
face (see Figure 7-5). You're going to make the hands seem to move by first drawing
them with blocks, then removing them by drawing them with AIR , then drawing them
again in a new position.
 
Search WWH ::




Custom Search