Hardware Reference
In-Depth Information
Adventure 8
Giving Blocks a Mind
of Their Own
COMPUTERS DON'T THINK. They aren't capable of having any thoughts at all;
they can only ever do what programmers tell them to do. You can, however, make com-
puters look like they are thinking and making decisions by themselves. By program-
ming your computer to “understand” what's happening and giving it rules to “decide”
what to do next, you can open a door to a lot of fun.
In this adventure, you are going to program a block friend who will follow you around,
provided you don't get too far away. You are also going to create a flying saucer that
chases you until it can get above you and beam you aboard.
You will learn how to make a block move and follow the path it decides is best, as well
as how to use the Python random module to make it look as if the computer is think-
ing. You will also create shapes using the MinecraftShape functions in the mine-
craftstuff module (which is included in your starter kit).
Your Block Friend
Minecraft can be a lonely world. But your player doesn't have to be alone—you can
create a block that will follow him around, talk to him and be his friend (see Figure 8-1).
 
Search WWH ::




Custom Search