A simple 2D racing game built using HTML5, CSS, and JavaScript. The objective of the game is to avoid crashing into other cars while racing along the road.
- Keyboard controls: Use the arrow keys to control the player's car.
- Collision detection: Game ends when the player's car collides with another car.
- Score tracking: Displays the current score and the highest score during the session.
- Simple UI: Minimal design with easy-to-understand controls and scoring.
- The player uses the arrow keys to move their car (red) up, down, left, and right.
- Avoid hitting the other cars (blue) that move down the road.
- The game keeps track of the player's score based on how long they survive.
- If you crash into another car, the game ends, and the start screen is displayed again.
- The highest score during the session is saved and shown on the screen.
- Clone the repository to your local machine:
git clone https://github.com/CSI-Trainee-2024/T3-Parikshit-2313007-2DRacingGame- Open
index.htmlin your browser to start the game.
# On macOS
open index.html
# On Windows
start index.htmlAlternatively, you can serve it with a local development server (such as Live Server in VS Code) to enable real-time updates while coding.
- Arrow Up: Move up
- Arrow Down: Move down
- Arrow Left: Move left
- Arrow Right: Move right
- Click the "Play" button on the start screen.
- Use the arrow keys to move your car and avoid obstacles.
- The score increases the longer you stay in the game.
- If you crash into another car, the game ends. Click "Play" to restart.
.
├── index.html # Main HTML file that renders the game
├── style.css # CSS for styling the game area and UI elements
├── script.js # JavaScript file containing the game logic
└── images # (optional) Folder for storing images like arrow keys or car sprites
Enjoy the game and feel free to modify it and make it your own! 🚗💨
If you have any questions or suggestions, feel free to reach out at:
- GitHub: https://github.com/parikshit-jaiswal
- Email: parikshitjaiswal82@gmail.com