Skip to content

CSI-Trainee-2024/T3-Parikshit-2313007-2DRacingGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2D Racing Game

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.

Features

  • 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.

Gameplay

  • 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.

Installation and Setup

  1. Clone the repository to your local machine:
git clone https://github.com/CSI-Trainee-2024/T3-Parikshit-2313007-2DRacingGame
  1. Open index.html in your browser to start the game.
# On macOS
open index.html

# On Windows
start index.html

Alternatively, you can serve it with a local development server (such as Live Server in VS Code) to enable real-time updates while coding.

Controls

  • Arrow Up: Move up
  • Arrow Down: Move down
  • Arrow Left: Move left
  • Arrow Right: Move right

How to Play

  1. Click the "Play" button on the start screen.
  2. Use the arrow keys to move your car and avoid obstacles.
  3. The score increases the longer you stay in the game.
  4. If you crash into another car, the game ends. Click "Play" to restart.

Project Structure

.
├── 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! 🚗💨


Contact

If you have any questions or suggestions, feel free to reach out at:


About

Click the link below to play the game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors