Download the Game Files
Collect all necessary files:
index.html: Defines the game’s structure and integrates scripts.
style.css: Manages visual styling and animations.
game.js: Handles the main game loop.
platform.js: Defines the platforms.
movement.js: Manages character movement.
trash.js: Manages collected trash.
sound.js: Handles audio feedback.
Set Up the Files
Place all files in a single folder to ensure proper linking between assets such as images and sounds.
Optional: Install a Local Server
For better performance and to test JavaScript functionality:
Using Python:
Open a terminal or command prompt.
Navigate to the folder containing the game files.
Run python -m http.server (Python 3) or python -m SimpleHTTPServer (Python 2).
Open your browser and navigate to http://localhost:8000.
Using Visual Studio Code:
Install the “Live Server” extension.
Open the game folder in Visual Studio Code.
Right-click index.html and select “Open with Live Server.”
Browser Compatibility
Use modern browsers such as Google Chrome, Firefox, or Microsoft Edge for optimal performance. Ensure that JavaScript is enabled.
How to Use
Start the Game
Open the index.html file in your browser by double-clicking it if running locally without a server.
If using a local server, navigate to the provided URL (e.g., http://localhost:8000).
Player Controls
Arrow Left: Move left.
Arrow Right: Move right.
Spacebar: Jump to navigate platforms.
Game Objective
Collect trash scattered around the park.
Identify the type of trash and sort it into the appropriate category:
Recyclable: Paper, plastic, and glass.
Non-Recyclable: Mixed or hazardous waste.
Gameplay Mechanics
Navigate platforms to reach different areas of the park.
Interact with trash using keyboard controls.
Earn points for correctly sorted trash.
Receive penalties for incorrect sorting with visual and audio feedback.
Game Feedback
Positive Feedback: Correct actions increase the score and trigger a “success” sound effect.
Negative Feedback: Mistakes decrease the score and trigger a “failure” sound effect.