A classic console-based car racing game built in C++ where you dodge enemy cars and try to achieve the highest score possible!
Car Game is an exciting console-based racing game that challenges players to navigate through traffic while avoiding collisions with enemy vehicles. Built entirely in C++, this game demonstrates classic game development concepts including:
- Real-time console graphics manipulation
- Collision detection algorithms
- Score tracking and persistence
- Simple AI for enemy vehicle movement
- Interactive menu system
The game features ASCII art graphics, smooth gameplay mechanics, and a ranking system to track high scores across gaming sessions.
- ๐ฏ Real-time Gameplay - Smooth car movement and enemy AI
- ๐ Score System - Track your high scores with persistent storage
- ๐จ ASCII Graphics - Retro-style console-based visuals
- ๐ฎ Simple Controls - Easy-to-learn keyboard controls ('a' for left, 'd' for right)
- ๐ Rankings - View your best scores and compete with yourself
- ๐ Infinite Gameplay - Continuous enemy spawning for endless fun
- ๐พ Score Persistence - Scores are saved to file for future sessions
- ๐ต Menu System - User-friendly interface with multiple options
Before running the Car Game, ensure you have:
- Windows Operating System (Required for Windows API functions)
- C++ Compiler supporting C++11 or later
- Microsoft Visual Studio (Recommended)
- MinGW-w64
- Dev-C++
- Git for cloning the repository
-
Clone the repository
git clone https://github.com/H0NEYP0T-466/Car_Game.git cd Car_Game -
Compile the game
# Using g++ (MinGW) g++ -o car_game project.cpp # Using Visual Studio Developer Command Prompt cl project.cpp /Fe:car_game.exe
-
Run the game
# Windows ./car_game.exe # or simply car_game
-
Launch the game by running the compiled executable
-
Choose from the main menu:
1- Start Game2- Instructions3- Rankings4- Quit
-
Game Controls:
Aora- Move car leftDord- Move car right- Avoid enemy cars falling from above!
-
Scoring:
- Earn points for each enemy car you successfully avoid
- Try to beat your high score!
- Scores are automatically saved to
scores.txt
-
Game Over:
- Game ends when your car collides with an enemy
- Your final score will be displayed
- Option to play again or return to main menu
Car_Game/
โโโ ๐ project.cpp # Main game source code
โโโ ๐ README.md # Project documentation
โโโ ๐ LICENSE # MIT License
โโโ ๐ CONTRIBUTING.md # Contribution guidelines
โโโ ๐ Car-Game-Code.pptx # Additional documentation
โโโ ๐ Documentation.pdf # Project documentation
โโโ ๐ scores.txt # High scores file (generated)
-
Game Engine Functions:
main()- Entry point and menu systemplay()- Main game loopcollision()- Collision detection logic
-
Graphics Functions:
drawCar()- Renders player cardrawEnemy()- Renders enemy vehiclesdrawBorder()- Game area boundariesgotoxy()- Console cursor positioning
-
Game Logic:
genEnemy()- Enemy spawning systemupdateScore()- Score managementsaveScoreToFile()- Score persistence
We welcome contributions from the community! Please read our Contributing Guidelines for details on:
- How to submit bug reports
- How to suggest new features
- Code style and standards
- Pull request process
This project is licensed under the MIT License - see the LICENSE file for details.
- Basic car movement and controls
- Enemy car spawning and movement
- Collision detection
- Score tracking and persistence
- Menu system with instructions and rankings
- Enhanced Graphics - Improved ASCII art and animations
- Power-ups - Speed boost, invincibility, extra lives
- Multiple Difficulty Levels - Easy, Medium, Hard modes
- Sound Effects - Basic console beeps for actions
- Multiplayer Support - Local two-player mode
- Statistics - Detailed game statistics and analytics
- Cross-platform Support - Linux and macOS compatibility
- GUI Version - Modern graphics using SDL or SFML
- Online Leaderboards - Global high score competition
- Theme System - Different visual themes and car designs
- Mobile Port - Android/iOS version
- Game Design Inspiration - Classic arcade racing games
- ASCII Art - Retro gaming community
- Windows Console API - Microsoft documentation and examples
- C++ Community - For excellent resources and tutorials
- Open Source Contributors - Everyone who helps improve this project
This project leverages several key technologies:
- C++ Standard Library - Core functionality and data structures
- Windows Console API - For graphics rendering and input handling
- File I/O Operations - Score persistence and data management
- Memory Management - Efficient resource utilization
- Object-Oriented Design - Clean, maintainable code structure
Made with โค๏ธ by H0NEYP0T-466
โญ Star this repo if you enjoyed the game! โญ
