Setup and Run Instructions
-
Clone the repository:
git clone cd
-
Install dependencies:
npm install
-
Run the game locally in the browser:
npm run dev
- This will start a local development server (usually at http://localhost:5173).
- Open the URL in a browser to play the game.
Note: The game is fully client-side and requires no backend. Modern browsers (Chrome, Firefox, Edge) will run it without issues.
Game Engine / Libraries Used
- Phaser 3: main game engine
- Vanilla JavaScript + ES Modules
- Vite: development and build tool
- Google Fonts: "Press Start 2P" for retro pixelated style
Design Choices and Gameplay Logic
-
Use the left & right arrow keys to move
-
Theme: Collect trash in the ocean to protect the environment.
-
Scenes:
- StartScene: displays title, instructions, and a clickable "PLAY" button with hover effect.
- GameScene: main gameplay where the player moves left/right to catch falling trash. Displays score and missed count. Difficulty increases progressively by trash falling faster as more items are collected.
- WinScene: appears when the player collects the target number of trash bags (numToWin, currently set to 15).
- GameOverScene: appears if the player misses 3 trash bags.
-
Player movement: Horizontal movement with responsive controls.
-
Interactive objects: Falling trash bags; collecting increases score, missing counts as a miss.
-
Win/Lose conditions: Win if collected enough trash, lose if 3 bags are missed.
-
Technical design: Modularized scenes, global configuration in 'config.js' for easy adjustments.