Learning to program with Minecraft

Gold Runner

To run the game, you will have to copy your file to the mcpi/api/python/ directory. Make sure Minecraft is running and then run your game with:

$ python treasureHunt.py

The first message (Move!) should appear on the screen, and the hunt is on!

Conclusion

The ability to program your Minecraft world using a simple Python API more than makes up for the lack of features in the Raspberry Pi version. Moreover, it's an entertaining way to help first-time programers, and kids especially, understand the use and usefulness of variables, loops, and functions, as well as to stimulate creativity and learn Python syntax.

Amazing projects are being created using the API, such as cannons [6], snake games [7], and more. As with Minecraft itself, the API is simple and straightforward, but by using the basic building blocks it provides, you can build really complex and interesting things.

Be aware, though, that Minecraft: Pi Edition is still in an early alpha stage and is prone to freezing and crashing, so I advise patience.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Using the Raspberry Pi as a Minecraft server

    Minecraft has millions of devoted fans worldwide, and players who organize a communal game with friends and acquaintances achieve an entirely new gaming experience. The Raspberry Pi is an excellent replacement for the Minecraft server.

  • Don't Use a Hammer

    When you first start building, you probably learn how to use one device and one programming language. Then comes the day you design a project that your toolset either can't solve or forces you to jump through too many hoops to get the outcome you desire. That's the day you start looking at new devices and languages to solve your problem. Having an arsenal of tools at your disposal makes solving problems easier.

  • Synchronizing with broadcasts

    This article draws inspiration from the popular Pokémon Go app to recreate a sprite hunting game in Scratch. The project explores synchronization and randomness as the player explores various backdrops in search of sprites.

  • Exploring the Kano Kit Pi pack and learning environment

    The Kano Kit learning platform puts the Pi in easy reach for even the youngest users.

  • Using graphical effects to distort a picture

    In this guessing game, graphic effects distort sprite costumes while the player tries to guess the animal shape. The game is creatively scored based on how much the shape is distorted.