Hardware Reference
In-Depth Information
Believe it or not, you have just learned all the basics you will be using in your
other adventures. Every Minecraft program has to import modules, connect to
the game, loop in a game loop, sense that something has happened and behave
differently as a result. From these simple beginnings you will find that many great
things will grow!
CHALLENGE
Do you think that checking the y coordinate (the up and down direction) will
improve the detection of whether your player is standing on the doormat?
Have a go. Modify your program to test all three coordinates of the doormat
and see if the application works any better.
DIGGING INTO THE CODE
Chances are you will have typed something wrong at some point, in which case
you will probably have seen a red error message on the Python Shell. It's a good
idea to have a look at the type of errors you can make, so you don't take fright
when you see them from time to time.
You might see a syntax error if you type the wrong symbols or get things in the
wrong order. If you miss out a symbol or type in a variable name when it is not
expected, you will get a syntax error.
For example, if you type the following line into the Python Shell, you will
see the  syntax error shown in Figure  2-6, because the equals sign is not
expected to  appear on its own; it is usually used together with variables
and other values:
=
FIGURE.2-6 Python shows that your code contains a syntax error.
continued
Search WWH ::




Custom Search