Hardware Reference
In-Depth Information
The size of the crater is set by the numbers inside the setBlocks() statement.
Do you think this is a good way of setting the size of the crater? What if you
wanted to make your crater twice the size, how much of the program would you
have to change to make this work? Don't you think I'm being a little lazy here?!
Why don't you try and improve on my program, so that it is very easy to change
the size of the crater?
CHALLENGE
To make the detonator more exciting, try adding some geo-fencing code like in
Adventure 2 to detect when your player is still in the blast zone. When the bomb
goes off, if you are in the blast radius, use a mc.player.setTilePos() to
catapult your player up into the sky.
CHALLENGE
Add three more buttons to your circuit, in the same way that you added the first
button. Then write some more Python code to make those buttons do different
things, like post random messages to the Minecraft chat, teleport your player to
a secret location, build blocks of different types where your player is standing, or
even build a whole house where you are standing. The following GPIO numbers
are safe to use for your three extra buttons.
button
Raspberry Pi
Arduino
BUTTON2
14
5
BUTTON3
23
2
BUTTON4
24
3
Leave your breadboard all wired up when you have finished this Adventure. Martin
will use this exact setup of electronic components again in the final Adventure 9
game, and I will use it again in the bonus chapter that you can download from
the Wiley website.
Search WWH ::




Custom Search