Table of Contents
This project consists of creating a small Arcade Game containing a simple 1 VS 1 game, using a Raspberry Pi and buttons/joystick.
The Project started on 16/05/2022, and the submission date was set for on 13/06/2022.
First, the creation of the 1 VS 1 game with the language (I choose Python and Pygame) of our choice and with some functionalities like :
-
5 screens :
- Main menu screen
- Game screen
- Score screen
- Instruction screen
- Settings screen
-
2 players with :
- Joysticks and Buttons (like PS4 controller)
- Rotation speed : 360° rotation
- Movement speed
- Health
- Firepower
- Shooting time
- Projectile velocity
Then, importation of our program into a Raspberry Pi Model 3B+ with the controllers plugged.
This game is inspired by the movie TOP GUN and it is an Air Battle Game (player against player) !
The Goal for both players will be to destroy the opponent in a DOG FIGHT. Both Players has bullets and missiles to shoot and 100 point of health. | Bullets = 5 damages / 20 points | Missiles = 15 damages / 40 points. |
At the end of the game, the score of the winner will be save in a json.file (saves.json) and display on the Score menu.
To play TOP GUN Fighter, you must be 2 players and have 2 controllers (PS4). You can also use the keyboard !
Note : In the menu of the game you can find the controls and rules on the Instruction section
- Z : Move forward
- Q : Rotation Left
- D : Rotation Right
- LEFT SHIFT : Bullets
- SPACE : Missiles
- UP ARROW : Move forward
- LEFT ARROW : Rotation Left
- RIGHT ARROW : Rotation Right
- LEFT CTRL : Bullets
- RIGHT SHIFT : Missiles
- JOYSTICK_LEFT : Rotation
- JOYSTICK_LEFT LEFT : Left Rotation
- JOYSTICK_LEFT Right : Right Rotation
- JOYSTICK_LEFT : Acceleration
- JOYSTICK_RIGHT UP : Propulsion
- JOYSTICK_RIGHT DOWN : Reduce Speed
- L1 : Bullets
- R1 : Missiles
In order to use our game, you have to clone the repo on the desktop of the Raspberry Pi:
git clone https://github.com/KevOneRedOne/TopGun_Fighter-Raspberry-Pi
Make sure that all dependencies are installed on your computer or the Raspberry :
- Python 3 :
python --version
orpy --version
- Pip :
pip --version
Install few packages :
- pygame :
py -m pip install -U pygame --user
- pygame_menu :
pip install pygame-menu -U
- pygame usb :
pip install pyusb
andpip install libusb
Then, go to the file:
cd TopGun_Fighter-Raspberry-Pi/
And let's play the game !!
python .\main.py
Ou
py .\main.py
On the Raspberry Pi, move the topgun.desktop file on the file script to the execution shortcuts :
sudo mv ./topgun.desktop /etc/xdg/autostart/topgun.desktop
Then, the program will be executed on the login.
- Score leader board
- Game runs at 100 fps (Adjust to 60 fps on the Raspberry Pi 3B+)
- Json file for the save of the score
- Keyboard and Joystick gameplay
- Timer for the Game
- Improvement of the score system
- Sound Effects
- Settings screen with the personalization of :
- Planes choices
- Speed and Firepower
- Wallpaper
- Improve UX/UI design
To succeed in making our project, we had to resource ourselves on the net, here are some of the resources we used :
- Python docs : https://www.python.org/
- Pygame docs : https://www.pygame.org/docs/
- W3schools : https://www.w3schools.com/python/
- Techwithtim tutorials : https://www.techwithtim.net/tutorials/
- Inspiration for my game : https://andrew-gg.itch.io/spacewar-top-gun
- PS4 Controller Tuto : https://github.com/anubisankh/dualshock4-python
- Pygame Joystick : https://runebook.dev/fr/docs/pygame/ref/joystick
- Pygame Menu : https://pygame-menu.readthedocs.io/en/4.2.8/index.html
- Raspberry Pi Docs : https://www.raspberrypi.com/documentation/