- Learn Linux
- Learn Electronics
- Raspberry Pi
- LPI certification
- News & Reviews
In this project I have ported graphical game that I created in Pygame Zero to the Raspberry Pi Pico with a Pimoroni Display Pack.
It’s a simple artillery based game based on projectile targetting. This a simplified version of other tank games, or even games based on killing worm like creatures.
Pimoroni have changed the software library used for controlling the Pico Display as well as other graphics displays for the Pico. The different screens now use a single graphics library. This meant making some significant changes to the game. This video explains those changes.
The updated source code is included on my github project.
This is a turn based pass and play version of the game. Firstly, tank 1 can adjust the aim and power before firing. If the shell hits the enemy tank then that’s a victory, if not then play changes to the other player.
The Raspberry Pi Pico is a small microcontroller board. It's not a full desktop style computer in the same way that the traditional Raspberry Pi is and it doesn't work with a normal screen.
Unlike a Raspberry Pi HAT which fits on top of the Raspberry Pi computer, this is called a pack because it goes on the back of the Pico like a back pack. The display pack is one of the less expensive add-ons which is a bit surprising considering it’s capability. Although it’s still many times more than the cost of a Pico.
The display pack a miniature screen a little over an inch in size. with a resolution of 240 x 130 pixels. It also has 4 buttons and a single RGB LED.
The tank game was originally created as part of my book Beginning Games Programming with Pygame Zero. It’s a demonstration of how you can created games in pygame zero using vector images.
I first converted the game to use object oriented programming. I then ported it to work on the Raspberry Pi Pico and the Pimoroni Display Pack.
The source code for both the Pygame Zero and the Raspberry Pi Pico Display Pack is available from github.
Please view the copyright information regarding use of the circuits.