/TopGun_Fighter-Raspberry-Pi

The TOPGUN fighter project is my 2nd year Bachelor project, developed in Python. It consists of creating a 1v1 arcade game using a Raspberry PI and PS4 Controllers

Primary LanguagePython


Logo

TopGun_Fighter

A small Arcade Game inspired by the movie TOP GUN

Report Bug · Request Feature

Table of Contents
  1. Explanation
  2. Goals
  3. TOP GUN FIGHTER
  4. How to play ?
  5. Installation
  6. Additional Functionalities
  7. Future Improvements
  8. Requirements
  9. Sources


Explanation of the project

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.


Goals of the project

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.


TOP GUN FIGHTER

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.

Game Screen

Menu Screen


How to play the game

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

Player 1 Keyboard :

  • Z : Move forward
  • Q : Rotation Left
  • D : Rotation Right
  • LEFT SHIFT : Bullets
  • SPACE : Missiles

Player 2 Keyboard :

  • UP ARROW : Move forward
  • LEFT ARROW : Rotation Left
  • RIGHT ARROW : Rotation Right
  • LEFT CTRL : Bullets
  • RIGHT SHIFT : Missiles

Players controllers :

  • 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

Installation

In order to use our game, you have to clone the repo on the desktop of the Raspberry Pi:

Clone Repository

git clone https://github.com/KevOneRedOne/TopGun_Fighter-Raspberry-Pi

Dependencies and Packages :

Make sure that all dependencies are installed on your computer or the Raspberry :

  • Python 3 : python --version or py --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 and pip install libusb

Run the Game

Then, go to the file:

cd TopGun_Fighter-Raspberry-Pi/

And let's play the game !!

python .\main.py 

Ou

py .\main.py 

Run on Raspberry

Auto-run on Raspberry

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.


Additional Functionalities

  • 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

Future Improvements

  • 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

Hardware and software requirements :

Stacks : Python with Pygame Pygame-menu Pyusb
Raspberry Pi or PC : Raspberry or PC PC PC
Controllers : PS4 XBOX

Sources

To succeed in making our project, we had to resource ourselves on the net, here are some of the resources we used :