Skip to content

quantcat26/dinosaur_game

Repository files navigation

Dinosaur Game

This project is a simple browser-based dinosaur game inspired by Chrome's offline Dino game. The dinosaur runs along a path, clouds and obstacles move across the screen, and the player must press the spacebar to make the dinosaur jump over obstacles.

The game is built with SVG, CSS animations, and JavaScript. Most of the motion is handled by CSS animations, while JavaScript is used to start and stop animations, handle keyboard input, and check for game over conditions.

Features

  • Animated sky and ground
  • Moving clouds in the background
  • A jumping dinosaur controlled by the spacebar
  • Randomly appearing obstacles
  • Game over detection when the dinosaur collides with an obstacle

How to Run

  1. Open index.html in a web browser.
  2. Wait for the obstacle to appear.
  3. Press the spacebar to jump over the obstacle.
  4. If the dinosaur hits an obstacle, the game ends and the Game Over message appears.

Implementation Overview

  • SVG is used to draw the game scene and characters.
  • CSS keyframe animations are used for clouds, obstacles, and the dinosaur jump.
  • JavaScript controls when animations start and stop.
  • Collision detection is done by comparing the positions of the dinosaur and the obstacle.

Files

  • index.html - The main game file containing the SVG markup, styles, and scripts.

Notes

  • The game uses the Google font Dosis.
  • You can replace the cloud, dinosaur, or obstacle artwork with your own SVG designs if needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages