Git Product home page Git Product logo

qc20 / obstacle-game Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 847 KB

This game is a basic obstacle avoidance game where the player controls a character and tries to avoid obstacles. The player can jump using the spacebar to avoid the obstacles. The game keeps track of the score and displays a timer. The game starts when the player clicks the "Start Game" button.

JavaScript 99.99% HTML 0.01%

obstacle-game's Introduction

Obstacles-Game

This is a simple game built using p5.js library. The game involves controlling a player object and avoiding obstacles to score points. The objective of the game is to achieve the highest score possible before colliding with an obstacle.

How to Play

To play the game, you have two options:

  1. Using the p5.js Editor: You can play the game directly in the p5.js Editor by following these steps:

    • Open the p5.js Editor in your browser (https://editor.p5js.org/).
    • Create a new project and copy the code from this repository into the editor.
    • Click the "Run" button in the editor to start the game.
    • Press the spacebar to make the player object jump and avoid obstacles.
    • The score and timer will be displayed on the screen, and the game will end if the player collides with an obstacle.
    • To restart the game, click the "Restart" button.
  2. Running Locally: If you prefer to run the game locally on your machine, you can follow these steps:

    • Download and install the p5.js library from the official website (https://p5js.org/download/).
    • Create a new HTML file and include the p5.js library by adding the following script tag in the HTML file:
      <script src="p5.js"></script>
    • Create a new JavaScript file and copy the code from this repository into the file.
    • Link the JavaScript file to the HTML file by adding the following script tag:
      <script src="your-script-file.js"></script>
    • Open the HTML file in a web browser to start the game.
    • Press the spacebar to make the player object jump and avoid obstacles.
    • The score and timer will be displayed on the screen, and the game will end if the player collides with an obstacle.
    • To restart the game, refresh the page.

Game Controls

  • Spacebar: Press the spacebar to make the player object jump and avoid obstacles.

Game Rules

  • The player controls a rectangular object and must avoid colliding with obstacles.
  • Each time the player successfully avoids an obstacle, the score increases.
  • The game ends if the player collides with an obstacle.
  • The player can restart the game by clicking the "Restart" button.

Acknowledgments

This game was created using the p5.js library (https://p5js.org/), a JavaScript library for creative coding.

Credits

The game code was written by [Author's Name] and is available on GitHub at [GitHub Repository URL].

License

This project is licensed under the [License Name] license - see the LICENSE file for details.

obstacle-game's People

Contributors

qc20 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.