PYTHON – PYGAME PROJECT FOR PRACTICE
GAME CHALLENGE – TANK WARS
Hao Wu is a senior software engineer at a multinational IT services company. Based in Australia, he holds a Master of Engineering in Computer Science and has more than 20 years of experience in the industrial software industry.
The goal of the challenge is to build the popular video game Tank Wars using Python and the Pygame library. The player controls a tank and his mission is to chase, fire and destroy as many enemy tanks as possible.
Hao has divided the project in 7 main steps including all the tasks that any game requires.
First, you will have to set up the game window, draw the surface, show and update the game information like score, remaining lives, etc. Next, you will have to create all the key elements to make it work: tanks, bullets, animation, etc. Movement, shootings, collisions, explosions, etc must also be coded with the help of pygame functions and sprites.
It is not only a game project but also an object-oriented programming challenge. You will have to create classes for all the key elements as well as multiple methods to make it work.
This practice is not only about coding but also about game architecture. It is an extensive project (more than 550 lines of code) so you should plan the design and workflow of the game before start coding.
There is a guidelines (16 pages) document to help you finish the game. It is broken down in 7 sections with several exercises and hints so you can complete the project step by step. There is also an extended version to make the game more challenging and interesting. You will also find guidance for this version.
DOWNLOAD / CONTENT
You will receive an email with a ZIP file. If you are a registered user, the download is always available on your account.
The downloadable zip is made up of the following files:
1) One PDF with the project description and the guide. It includes step by step guidance and hints to help you complete the challenge. There is also an extended version in case you want to make it more challenging. Finally, a section with ideas to work on your own is provided at the end of the guide.
2) Two .py files with the solutions. One for the regular project and another one for the extended version You will find not only the source code but also detailed explanations about how the code works. Moreover, Hao is a software engineer, so the code is clean, readable and written by a professional developer. A great way to learn and adopt right habits to create good quality code.
3) Three folders with images and sound files.
WHAT YOU WILL PRACTICE
– Libraries: Pygame, Math, random.
– Writing and calling methods.
– Define functions with “for/while” loops and conditional statements (if/else).
– Inheritance: use the __init__()
Tank wars is a simple game but a challenge for advanced level students. You must know object-oriented programming and it is also recommended (although not mandatory) to be familiar with the pygame library. Otherwise, you will need to read some of the pygame documentation.