Subscribe to our newsletterWe’ll send you our favorite blog posts, tutorials, events, and more!
In this project, Juni instructor Eva will be showing us how to build a project inspired by Earth Day! In this game, the player helps out ocean creatures by swimming around and cleaning up trash.
First read through the project instructions and steps, to try and figure out how to code this project on your own. If you get stuck or need help, watch Eva's video tutorial or view her solution code below!
Who is this for?
- Language: Scratch
- Juni Level: Scratch Level 1
- Ages: 8-11, with assistance if needed
- Coding Experience: Experience building projects in Scratch. Students should be comfortable with basic concepts like event listeners, variables, and loops. (Review video below, if needed)
This project will help you practice customizing in Scratch, creating variables, using loops, writing conditionals, moving along the coordinate plane, and more.
- Language: Scratch
- Juni Level: Scratch Level 1
- Core concepts: Loops, Variables, Conditionals, Event Listeners
- Lines of Code: ~50 blocks
- Difficulty: Moderate
- Est. Time: ~1hr, but this varies by student and how creative you get!
What should I know or review before doing this project?
First time using Scratch? Watch Instructor Maya's intro to using Scratch, if you need some help or review.
Maya's Intro to Scratch:
Using coordinate planes
Understanding the x and y-axes is key to building projects like this one in Scratch. Coordinate planes help us tell our sprites where to move, or tell the program where we want things to be on our screen.
Review or learn about coordinate planes in our Intro to Coordinate Planes lesson with Juni Instructor Genesis.
Build an Ocean Cleanup Game
Watch Eva play her finished version of the game or play it yourself, to better understand what we are trying to create in this project.
Eva's Game Demo:
Make a game where you can use your arrow keys to help pick up falling trash in the ocean! Be careful – avoid sharks and try not to leave too many pieces of trash uncollected! If you touch a shark or miss up to 5 pieces of trash, then it's game over.
Extra feature: Catch bubbles to get a temporary speed boost!
Here are the basic steps Eva took to build this game. Use these steps for guidance or hints!
- Start with creating your custom Sprites! Scratch has a lot of great ones, but we can customize our own to make Sprites that don’t currently exist. Create 3-5 different garbage sprites as well as adding a diver to represent the player.
- Next, we can create the different backdrops used in this game such as the ocean background and a “Game Over” backdrop.
- Create two variables: one to keep track of the amount of trash collected and another that keeps track of the number of missed trash.
- Next, let’s write the code for the diver! We’ll use a forever loop to allow our diver to be controlled by the arrow keys and broadcast a “Game Over” message if there are five missed trash.
- Now program your garbage sprites. Let’s program them so that they continuously fall down from the top of the screen in random x-coordinates using a forever loop.
- Implement collecting or missing trash. Make sure to check if trash is touching the diver. If they are, we want to increment the number of trash collected, and make the garbage move back to the top of the screen. If the garbage touches the bottom of the ocean, increment the missed counter and make it move back to the top of the screen.
- Feel free to get creative with this! For an extra challenge, you can implement a shark sprite that the diver should avoid. In addition, you can add some bubbles that provide a temporary speed boost as well as add some floating fish around the ocean to give your game a more realistic feel. You can also try experimenting with adding music and sound effects when trash is missed or collected.
Try to do the project on your own first, and get creative with it! If you get stuck or want to check your code, check out Eva’s solution and tutorial video below.
Project Solution & Tutorial
Check your answers or get help by viewing Eva's solution and tutorial videos:
Eva's Tutorial for Customizing Sprites and Backdrops:
Eva's Code Walkthrough:
Want to keep learning?
We hope you enjoyed Eva's Scratch project!
To keep practicing or learning, please check out more of our coding tutorials on our blog.
Looking up your coding questions is one of the best ways to learn!
Another great way to learn is from an experienced coder or instructor. Juni CS instructors like Eva work closely with students ages 8-18, and are specially trained to adapt to each child's unique learning style, pace, and interests.
Read more about our coding courses and curriculum, or get started with our Admissions Team to learn which course is best for your child’s coding journey. You can also read more about how we use Scratch to teach coding.