Download presentation
Presentation is loading. Please wait.
Published byHomer Gilmore Modified over 9 years ago
1
Introduction to Minecraft Pi Aims: To know what Minecraft is To learn how to enter code into Minecraft Pi To successfully enter at least 2 Python programs into Minecraft Pi
2
What is Minecraft Pi? Minecraft is a program which lets you build virtual worlds, block-by-block, in a range of different materials. You get a basic world given to you, it is then up to you what goes into it. Minecraft Pi is an early development version of Minecraft Pocket Edition for phones & tablets.
3
Minecraft is deliberately ‘blocky’ like LEGO, because it is easy to build when your bricks are the same shape! The blocks are deliberately NOT highly detailed as this means the graphics can be drawn/updated quickly as you move around. The Pi edition is special because it is not ‘locked down’ so you can code straight into it and make ‘Magic happen.’ “It looks rubbish!”
4
Intro Video – What can you do with Minecraft Pi? Source: youtube.com/watch?v=daT_R5ckIkU
5
You will need to arrange 2 program windows on your desktop Minecraft Pi Python 2 Python is a programming language you will use to interact with Minecraft (make buildings, show messages, etc.) Load BOTH programs and arrange your screen like this… Get Set…
6
In Python, you have the window to store the program code AND a window where it runs. You need to type your code into this window Get the right Python
7
Minecraft & Python Screens To enter your code, you click FILE and NEW… To move the mouse out of Minecraft, press the TAB key first
8
Have a quick look around your world, before we move on Moving around in Minecraft KeyAction SpaceJump Double-Tap SpaceFly or Land ShiftDuck EInventory EscBack to Menu LEFT RIGHT UP DOWN SPIN CAMERA PLACE BLOCK DESTROY BLOCK
9
Start a new Python window, by clicking ‘File’ and ‘New.’ Click in your new empty Python window and type this code. import mcpi.minecraft as minecraft mc = minecraft.Minecraft.create() msg = “Hello world” mc.postToChat(msg) Click on File and save your code in your Pi ‘Documents’ folder as text.py Try another few. What happens with long sentences? Text Messages Capital letters and spaces MUST be correct, or your code won’t work
10
Graphs use X co-ordinates for left-right and Y co-ordinates for up-down. Minecraft is a 3D game, so also has forwards-backwards movement. X = Left-Right Y = Up-Down Z = Forward-Backward Where am I?
11
There I am! ( -3, 33, 97 )
12
Start a new Python window by clicking ‘File’ and ‘New’. Click in this new window and type this code. import mcpi.minecraft as minecraft import time mc = minecraft.Minecraft.create() time.sleep(1) pos = mc.player.getPos() mc.postToChat(“You are located x=“ +str(pos.x) + “, y=“ +str(pos.y) +”, z=“ +str(pos.z)) time.sleep(2) mc.postToChat(“Get ready to fall from the sky!”) time.sleep(5) mc.player.setPos(pos.x, pos.y + 60, pos.z) Click on File and save your code in your Pi ‘Documents’ folder as teleport.py Teleporting If you can’t read the code, ask for a worksheet
13
You can now choose your next challenges. These are: Challenge Sheets EASYHARDEXTREME TeleportingInstant BuildingsTreasure Hunt Flower StalkBuilding BridgesWhack-a-mole! Melon Teleporter These do get difficult, so do try both Easy and at least 2 Hard sheets before doing the Extreme level
21
With a Raspberry Pi camera you can even Minecraft your face!
22
http://fortoffee.org.uk/wp- content/uploads/2014/07/Worksheet-Minecraft.pdf http://fortoffee.org.uk/wp- content/uploads/2014/07/Worksheet-Minecraft.pdf http://blog.whaleygeek.co.uk/minecraft-pi-with-python/ http://blog.whaleygeek.co.uk/minecraft-pi-with-python/ http://www.stuffaboutcode.com/p/minecraft.html http://www.stuffaboutcode.com/p/minecraft.html Adventures In Raspberry Pi – Carrie Anne Philbin – John Wiley & Sons - 2014 Sources
23
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.