Skip to content

madmanmr/ProjectileMotion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

Projectile Motion Game

A Python/Pygame game that combines projectile motion physics with a target shooting challenge.

The project started as a projectile motion simulator and later evolved into a game where the player must hit a target using physics calculations.


Controls

Variable Controls

Control Function
+ Gravity Increase gravity
- Gravity Decrease gravity
+ Velocity Increase launch velocity
- Velocity Decrease launch velocity
+ Angle Increase launch angle
- Angle Decrease launch angle

Game Controls

Button Function
Start Fire projectile
Restart Generate a new target
Aim Assist Shows predicted trajectory

Scoring

Target Ring Points
Bullseye 50
Middle Ring 30
Outer Ring 10

When Aim Assist is enabled:

Target Ring Points
Bullseye 25
Middle Ring 15
Outer Ring 5

Requirements

How to run:
-click this link for web version https://madmanmr.github.io/madmanmr-ProjectileMotion-build-web/ -install localy (wouldn't recommend doesn't really work)- https://github.com/madmanmr/ProjectileMotion/releases/download/ProjectileMotionGame/ProjectileCode.zip

Physics Used

Horizontal Motion

x = vcos(θ)t

Vertical Motion

y = vsin(θ)t - ½gt²

Maximum Height

H = (vsin(θ))² / (2g)

Range

R = (v₀² sin(2θ)) / g

Flight Time

T = (2vsin(θ)) / g

Development Log

14/06/26 – Planning & Physics

  • Revised projectile motion equations.
  • Set up the Pygame window and project structure.
  • Implemented the core projectile motion calculations.

15/06/26 – User Interface

  • Added buttons and variable displays.
  • Fixed timing issues so the simulation matched theoretical flight times.
  • Added an end screen and restart system.

16/06/26 – Refactoring & Bug Fixes

  • Reorganised the code structure.
  • Fixed several timing and display bugs.
  • Improved variable updates and restart functionality.

17/06/26 – Game Features

  • Added a randomly positioned target.
  • Added projectile splash effects.
  • Implemented collision detection.
  • Created a multi-zone scoring system.
  • Added an aiming line.

18/06/26 – Aim Assist

  • Added a trajectory prediction parabola.
  • Introduced a score penalty when aim assist is enabled.
  • Improved the overall UI layout.

19/06/26 – Final Polish

  • Improved button and screen layouts.
  • Added a Game Over screen.
  • Added final score display and Play Again button.
  • Fixed remaining bugs and completed the project.

Features

  • Adjustable launch velocity
  • Adjustable launch angle
  • Adjustable gravity
  • Accurate projectile motion physics
  • Random target placement
  • Multi-zone scoring system
  • Splash effects
  • Aim assist trajectory prediction
  • Live flight statistics
  • Restart functionality
  • Game Over screen

What I Learned

  • Projectile motion physics
  • Pygame development
  • Collision detection
  • Real-time simulation
  • UI design
  • Debugging and refactoring

Future Improvements

  • Moving targets
  • Wind resistance
  • Multiple levels
  • High score system
  • Different target types
  • Better graphics
  • Sound effects
  • Power meter

Final Thoughts

This was my second python project and I really enjoyed making more of a game with it. I found using the basic pygame quite simple as I had previously used pygame. The scale factor to convert pixels to metres and clock to get all the statistics accurate were a struggle. My code layout was an improvement to my last project however, I could make the code much smaller and more efficient. I will try to write a proper plan of my next project on paper before I start coding it to help get the layout right. Overall I really enjoyed making this game and I would recommend making physics simulations in python. Hope you enjoy my game :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages