The Raspberry Pi Experience
This project was quite easy because it was our first one. It was a fun and long project it was also our introduction to raspberry pi 1. We used python to use as a gaming system to operate minecraft on the pi.
Key | Action |
---|---|
W | Forward |
A | Left |
S | Backward |
D | Right |
E | Inventory |
Space | Jump |
Double Space | Fly / Fall |
Esc | Pause / Game menu |
Tab | Release mouse cursor |
With Minecraft running, and the world created, bring your focus away from the game by pressing theTab
key, which will free your mouse. Open Python 3 from the application menu and move the windows so they’re side-by-side.
You can either type commands directly into the Python window or create a file so you can save your code and run it again another time.
If you want create a file, go to File > New window
and File > Save
. You’ll probably want to save this in your home folder or a new project folder.
Start by importing the Minecraft library, creating a connection to the game and testing it by posting the message “Hello world” to the screen:
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
mc.postToChat("Hello world")
If you’re entering commands directly into the Python window, just hit Enter
after each line. If it’s a file, save with Ctrl + S
and run with F5
. When your code runs, you should see your message on screen in the game.