Trash Tossers: Eco Cleanup Quest Inspiration The idea for Trash Tossers was born out of a shared interest in environmental activism and a love for simple, interactive games. We wanted to create a project that was both fun and meaningful, encouraging players to think about pollution and the importance of cleaning up litter — all through the engaging lens of a digital adventure.
What We Learned This project helped us grow in many areas of software development:
Java Swing: We gained experience using Java Swing to manage graphics, user input, and GUI components.
Game Mechanics: We explored how to simulate basic game mechanics like player movement, object interaction, and win conditions.
Debugging Logic: We practiced handling arrays, conditional logic, and collision-like behavior using transparent buttons over images.
Project Planning: We learned how to take a big idea and break it into smaller, buildable parts.
How We Built It We used Java and the Swing library to create the game's interface and visuals.
The background map, trash can, and trash pieces were found off of the internet.
Player movement was handled using KeyListener, simulating a scrolling map effect by moving background elements.
Interactive trash pieces were implemented with invisible JButton components layered on top of images.
A trash can button lets players "throw" selected trash into it. Once all trash is disposed of, a win screen is triggered.
Challenges We Faced
Coordinate Management: Aligning buttons and images while the map scrolled was tricky. We had to keep everything synced to the player's viewpoint.
Redundancy in Code: Initially, we had many repetitive conditionals for trash button selection. We refactored this into a loop to make the code cleaner and easier to maintain.
Focus and Input: Ensuring the game panel consistently accepted key inputs while also handling button clicks was a learning curve.
Asset Handling: Managing and correctly displaying custom images and animations across different screen positions took a lot of trial and error.
To play our game, use WASD to move up and down and search the village for trash. Click the trash, then the can to throw it away. When you find all 10 pieces of trash, you win!


Log in or sign up for Devpost to join the conversation.