This project is a game designed to teach Pygame, simulate object motion, and predict their coordinates for interception. The game simulates the operation of an air defense system (ADS) protecting a ground object from missile attacks. The system includes a radar that detects airborne targets and a gun that fires projectiles to intercept them.
- Control the gun and shoot at targets.
- Automatic firing mode based on radar data.
- Missiles accelerate over time, adding to the challenge.
- A new background appears every time the game starts.
The radar scans the airspace and provides information about airborne targets in polar coordinates:
- max_distance: Maximum detection range.
- scan(): Method that returns a list of visible targets (ID, angle, distance).
The gun fires projectiles at targets with a specified speed. After each shot, the gun is blocked for a short time.
- fire(): Method that fires a projectile.
Rockets move toward the protected object at different speeds. If a rocket reaches the object, it is considered destroyed.
- Rockets accelerate over time, increasing the game's difficulty.
Bullets are fired from the gun and move towards the rockets. Upon hitting a rocket, both objects disappear.
- Rockets appear at the top of the screen and move towards the target.
- The player or the automatic system must intercept the rockets before they hit the object.
- Manual Mode: The player manually controls the gun using keys.
- Control Keys:
LEFT
andRIGHT
to rotate the gun,SPACE
to shoot.
- Control Keys:
- Automatic Mode: The gun automatically fires at targets based on radar data.
- Activation Key:
F
toggles between manual and automatic modes.
- Activation Key:
- Rocket Acceleration: Over time, rockets speed up, making the game more challenging.
- Random Background: A new background is set each time the game starts.
- Clone the repository:
git clone https://github.com/zv3zdochka/Anti-air-game
- Install dependencies:
pip install -r requirements.txt
- Run the project:
python main.py
- Python 3.8+
- Pygame library
- zv3zdochka
- Project created at 2023.
This project is licensed under the Apache 2.0.