Asteroids

Category:Projects | Posted on:January 9, 2025
asteroids

This is a simple Asteroids game implemented in JavaScript using the HTML5 Canvas API.

Installation

Clone the repository to your local machine:

git clone https://github.com/yourusername/asteroids-js.git

Navigate to the project directory:

cd asteroids-js

Open index.html in your web browser to start the game.

Usage

The game starts automatically when you open index.html in your browser. The player controls a spaceship that can move and shoot missiles to destroy asteroids.

  • The player controls a spaceship that can move and rotate.
  • Asteroids spawn at random intervals and move across the screen.
  • The player can shoot missiles to destroy the asteroids.
  • The game ends when the player’s spaceship collides with an asteroid.

Controls

  • W: Move forward
  • A: Rotate left
  • D: Rotate right
  • Space: Shoot missile
  • Enter: Restart game (after game over)

Known Bugs

  • Sometimes an asteroid that isn’t hit will blink out when another one is shot
  • Sometimes points do not register when an asteroid is destroyed.