Skip to content

satyansh2004/collect-black-ball-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฏ Kontra.js Target Game

A lightweight 2D browser game built using Kontra.js and HTML5 Canvas.

The player moves inside the canvas using arrow keys.
A target appears at random positions, and whenever the player reaches the target, it relocates to a new random position.


๐Ÿ›  Tech Stack

  • JavaScript (ES Modules)
  • Kontra.js
  • HTML5 Canvas
  • npm + Vite (dev server)

๐ŸŽฎ Controls

  • Arrow Left โ€“ Move left
  • Arrow Right โ€“ Move right
  • Arrow Up โ€“ Move up
  • Arrow Down โ€“ Move down

โš™๏ธ Game Logic

  • Player movement with boundary constraints
  • Target spawns at random positions inside the canvas
  • Target relocates when the player overlaps with it
  • Simple collision detection (AABB)

๐Ÿš€ Getting Started

Clone the repo

git clone https://github.com/satyansh2004/collect-black-ball-game.git

Install dependencies

npm install kontra

Run the game

npm run dev

Open the local server URL shown in the terminal.


๐Ÿ“Œ Purpose

This project is a practice exercise to understand:

  • Game loops
  • Sprite-based movement
  • Collision detection
  • Basic game mechanics using Kontra.js

Play here - https://boxmoves.netlify.app/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published