Skip to content

Rebanta-Gupta/Treasure-Game

Repository files navigation

Treasure Game 🏃💎

A simple 2D vertical runner game built with JavaScript and the p5.js library. Test your reflexes by collecting falling treasures while dodging dangerous swords!

🎮 How to Play

The goal is to collect as much treasure as possible to increase your score without getting hit.

  • Controls: Move your mouse cursor left and right to control the runner's position.
  • Objective: Catch the valuable items falling from the top of the screen.
  • Game Over: The game ends immediately if you touch a Sword.

🏆 Scoring System

Different items grant different amounts of points:

Item Points
💵 Cash +50
💍 Jewelry +100
💎 Diamonds +150

🛠️ Built With

  • p5.js - A JavaScript library for creative coding.
  • p5.play - A library for sprite animation and game interactions.
  • HTML/CSS

🚀 Getting Started

To play the game locally on your machine:

  1. Clone the repository:
    git clone https://github.com/Rebanta-Gupta/Treasure-Game.git
  2. Open the game:
    • Navigate to the project folder.
    • Open the index.html file in your preferred web browser.
    • Note: For the best experience (and to avoid local file security restrictions), it is recommended to use a local development server (like VS Code's "Live Server" extension).

📂 Project Structure

  • sketch.js: Contains the main game logic, loop, and sprite management.
  • index.html: The entry point for the game.
  • assets/: (Images like Road.png, Runner-1.png, cash.png, etc.)

Enjoy the run and get that high score!

About

This repository contains the source code for Treasure Game, a simple 2D vertical runner game built using the p5.js library and the p5.play addon. In this game, the player controls a running character who must navigate a scrolling road to collect various treasures while avoiding obstacles.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors