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.
This version is a turn based pass and play version of the game. First 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 play.
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.
Tank Game
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.
For more details, including links to the source code see:
http://www.penguintutor.com/projects/...
For programming details for the Raspberry Pi Pico display pack see:
http://www.penguintutor.com/programmi...
You can also find out more about the original Pygame Zero version of the game here:
• Beginning Game Programming with Pygam...
I've also added a related video using bitmap sprites at: • Pico - Creating Bitmaps on tiny micro...
Chapters
00:00 Introduction to the tank game
00:40 Quick demo of the pico game
01:06 About the Pico and the Display Pack
02:47 Porting to the Pico (Pygame Zero game)
04:50 About object oriented programming (OOP)
05:45 Installing the Pimoroni version of MicroPython (uPython)
06:03 Code Walkthrough
07:05 The Tank class source code
09:09 The Land class source code
10:58 The Shell class source code
12:12 The main game source code
18:50 Starting automatically with main.py
19:46 Future improvements