A simple 2D racing game built with Java, featuring basic car physics, track racing, and score tracking.
- 2D top-down racing gameplay
- Car physics (acceleration, deceleration, steering)
- Track collision detection
- Lap timing system
- High score tracking
- Keyboard controls
- Java JDK 8 or higher
- Maven 3.6 or higher
- Any IDE that supports Java (VS Code, IntelliJ, Eclipse)
racing-game
├── src
│ ├── main
│ │ ├── java
│ │ │ ├── game
│ │ │ │ ├── Game.java
│ │ │ │ ├── GameWindow.java
│ │ │ │ └── GamePanel.java
│ │ │ ├── entities
│ │ │ │ ├── Car.java
│ │ │ │ └── Track.java
│ │ │ └── utils
│ │ │ ├── Constants.java
│ │ │ └── InputHandler.java
│ ├── test
│ │ └── java
│ │ └── game
│ │ └── GameTest.java
├── pom.xml
└── README.md
-
Clone the repository:
git clone <repository-url> -
Navigate to the project directory:
cd racing-game -
Build the project:
mvn clean install -
Run the game:
mvn exec:java -Dexec.mainClass="game.Game"
- ↑ (Up Arrow): Accelerate
- ↓ (Down Arrow): Brake/Reverse
- ← (Left Arrow): Steer left
- → (Right Arrow): Steer right
- ESC: Pause game
- ✓ Basic game structure
- ✓ Car movement physics
- ✓ Collision detection
- ✓ Track design
- ✓ Lap timing system
- Multiple tracks
- Sound effects
- Menu system
- Use the arrow keys to control the car.
- The objective is to complete laps on the track as quickly as possible.
- Avoid collisions with the track boundaries.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.