A Python-based car racing game featuring real-time collision detection, built for learning and fun! Control your car, dodge obstacles, and compete for the highest score.
- Real-time Collision Detection: Accurate collisions between cars and obstacles for a challenging experience.
- Custom Graphics: Includes images for cars and the road for a visually engaging interface.
- Score Tracking: Keeps track of player performance throughout the game.
- Simple Controls: Easy-to-learn controls for quick gameplay.
- Python 3.x
pygamelibrary
Install pygame using pip if you don't have it:
pip install pygame- Clone the repository:
git clone https://github.com/iamtahasc/Collision-Detection-Car-Racing-Game.git
- Navigate to the project directory:
cd Collision-Detection-Car-Racing-Game - Ensure all image files (
LeftCar1.jpeg,RightCar1.jpeg,Road.jpeg) are present in the directory.
python main.py- The game window displays a race track with two cars and a scrolling road.
- Control your car using the keyboard to avoid obstacles and other cars.
- The collision detection algorithm checks for overlaps between the player’s car and obstacles, ending the game on collision.
- The game keeps track of your score, which increases the longer you avoid collisions.
main.py- Main game logic and loop.LeftCar1.jpeg,RightCar1.jpeg- Car images used in the game.Road.jpeg- Road background image.
You can replace LeftCar1.jpeg, RightCar1.jpeg, and Road.jpeg with your own images to personalize the game.
This project is open-source and available for any educational or personal use.
Developed by iamtahasc.
Enjoy racing and improving your programming skills!