Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

Maker projects

Space Asteroids - Games Programming and Physical Computing for the Raspberry Pi

Space Asteroids physical computing game written in Scratch or Python 3, using Pygame Zero and GPIO Zero

The game is a cross between Space Invaders and Asteroids. All the sprites are created from scratch in Blender and programmed to interact with electronic button switches and an LED.

Screen shot Space Asteroids physical computing game written in Python 3, using Pygame Zero and GPIO Zero

Workshop – Create Space Asteroids, physical computing computer game for Raspberry Pi – Scratch Version

Now Updated for Scratch Version 3

This worksheet is created for a version of the Space Asteroids game that is created in Scratch 3 on the Raspberry Pi.

It’s designed for those young and old who have preferably done a bit of Scratch programming before, but want to take first steps in physical computing or designing an interactive game. It’s also suitable for complete beginners to Scratch, who may need some help to get started with using Scratch.


Space Asteroids physical computing game for the Raspberry Pi - Scratch version  3
Worksheet – Space Asteroids physical computing game for the Raspberry Pi – Scratch version 3

You can also download the complete game of Space Asteroids (Scratch 3) for the Raspberry Pi.

The older version of the document (based around Scratch 2) is still available, although the Raspberry Pi no longer includes Scratch 2. It is therefore recommended that the newer Scratch 3 version is used instead.
Space Asteroid for Scratch version 2 (old version)

Workshop – Create Space Asteroids, physical computing computer game for Raspberry Pi – Python Pygame Zero version

This worksheet is created for a version of the Space Asteroids game that is created in Pygame Zero (Python 3) on the Raspberry Pi.

This is designed for older students and adults that have already done some programming in Python, but want to learn about designing games in pygame zero or how to connect to simple electronics using gpio zero.


Space Asteroids physical computing game for the Raspberry Pi - Pygame Zero and GPIO Zero (Python 3)

Worksheet – Space Asteroids physical computing game for the Raspberry Pi – Pygame Zero and GPIO Zero (Python 3)

Version 1.2 - The code has been updated to use the same physical pins as the Scratch 3 version, so that both can be developed on the same Raspberry Pi without needing to rewire the GPIO pins.

You can download version 1.2 of the source code file: space-asteroids.py.txt. Note that the files has .txt added and should be saved as space-asteroids.py.

Version 2 (code only) - Additional code allows for the speed of the launcher to increase when the key / button is kept pressed. This means that it will take longer before it is not physically possible to move fast enough to fire at the asteroid. This is updated in the version 2 source code file only, it is not included in the worksheet.

You can download version 2.0 of the source code file: space-asteroids2.py.txt. Note that the files has .txt added and should be saved as space-asteroids.py2.

Image files

The image files used in the project are available from the link below.

Videos coming soon ...
To find out about the updates please:
Subscribe to the PenguinTutor YouTube Channel
and
Follow @penguintutor on Twitter

Previous Pygame Zero for makers
Pygame Zero for makers
Next Nginx Reverse Proxy for IoT
Nginx Reverse Proxy for IoT