Save the Planet, One Toss at a Time!

Get ready for a fast-paced challenge in this MakeCode Arcade game! You’ll need quick reflexes to snatch the recyclable materials whizzing by and steer clear of the non-recyclable trash. It’s a fun and action-packed way to learn to identify what belongs in the recycling bin.

Gather

You’ll need the following items to complete this project:

  • Chromebook, laptop, or desktop
  • Access to MakeCode Arcade
  • OPTIONAL: micro:bit (V2), CodeCTRL, and microUSB cable

Play

Use the joystick or the arrow keys on your keyboard to collect as many recyclable objects as you can while avoiding non-recyclables.

Want to play this game on CodeCTRL? Learn how to download it now!

Code

Let’s take a closer look at the code we’ve used to make this game! You can click on the comments throughout the program to learn more about what each block does.

Understand

At a high-level, the program is doing three things:

  1. Setting Up the Game: This includes creating your player, deciding how many lives you start with, and making sure you can control your character on the screen.
  2. Making Things Fly: The program constantly creates new items (aka projectiles!) that move across the screen. It decides what these items look like, where they appear along the y-axis, how fast they are and in which direction they move!
  3. Checking for Collisions: The program triggers downstream actions when your player touches certain projectiles. Depending on what you bump into (something recyclable or non-recyclable), different things will happen, like getting points or losing a life.”

Improve

Want to make the game your own? Click the ‘Edit’ symbol in the top right corner of the code snippet above.

Edit button in MakeCode Arcade editor

Then, try:

  • Customizing the visual and sound effects that happen after a collision
  • Designing new sprites to be the recyclable and non-recyclable projectiles
  • Making some recyclables worth more points than others
  • Keeping track of the highest score
  • Making the game more difficult over time by:
    • Increasing the speed of the projectiles
    • Increasing the frequency of the projectiles
    • Introducing more types of non-recyclable items

Feeling Stuck? Explore the Knowledge Base for common questions and troubleshooting tips.