Monday 2 March 2015

Minecraft - Star Wars

Myself and David Whale (my co-author on Adventures in Minecraft) were asked if we would do a talk on "Hacking Minecraft" at the Raspberry Pi 3rd Birthday Party. I wanted to do something fun to show you how you can do amazing things in Minecraft using the Pi API.


After coding the Solar System in Minecraft I had the idea of creating the Death Star which would be able to 'fire' at the planets and destroy them.  I ended up coding an animation of the Death Star destroying Alderaan right up to Luke flying down the trench and successfully bombing the exhaust port with a block of TNT.


If you want to try it out yourself, all the code in at https://github.com/martinohanlon/minecraft-starwars. To download the code and run it on your raspberry pi, follow these instructions.

Run Minecraft: Pi Edition and open a world.

Open LX Terminal, and run the following commands to download the program and run the program

cd ~
git clone https://github.com/martinohanlon/minecraft-starwars
cd minecraft-starwars
python minecraft-starwars.py

The code relies heavily on the minecraftstuff module which is included in the mcpi directory of the repository, so if you copy the program anywhere else be sure to copy the mcpi directory too.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. The player starts at a position in the on the ground underneath an x wing. Any tips on how to we navigate to where the action is? Thanks!

    ReplyDelete

Note: only a member of this blog may post a comment.