O'Reilly logo

Adventures in Minecraft by Martin O'Hanlon, David Whale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9781118946916-co0801.tif

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 computers look like they are thinking and making decisions by themselves. By programming 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 thinking. You will also create shapes using the MinecraftShape functions in the minecraftstuff 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).

9781118946916-fg0801.tif

FIGURE 8-1 Create a Hello block friend to accompany your player on his Minecraft adventures.

To program a block friend you need to think like her! She will be happy if she’s near your player, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required