girl at computer with woman looking over shoulder

Debugging your Code

WHAT IS DEBUGGING?

A bug in your code means a problem or error. To debug means to get rid of the error. 
 
The term debugging came from Admiral Grace Hopper, a pioneer in computing. She was working on the Mark II computer at Harvard University in the 1940s and a moth got stuck in the computer and stopped it from working.
 
Getting rid of the moth, she said they were “debugging” the system. Programmers use the term now to mean “fixing errors in my code”. 
Grace Hopper

It’s not always easy to figure out why your code is not working.

dog looking at computer

The video below gives you some tips for how to help see what might be going on in your App Inventor project, so you can successfully debug your app so it works perfectly!

In the video below, learn some tips to help you debug your Scratch code.

girls coding with mentor helping

Coding Conditionals in Scratch

When you code a Scratch project, you sometimes want the sprites to do different things, depending on what is happening in the project.
 
For example, in the Recycle Game in Unit 5, you used an if-then-else block to add 1 to the score if the user moved the item onto the correct Sprite. Else, the project subtracted 1 from the score.
if else block in scratch
The video below helps to explain the different types of conditional blocks, which are blocks that cause different actions depending on a condition.
 
The girl is using a different coding language than Scratch, so the blocks look a little different and have different colors, but the ideas are the same.

Scratch game apps are really fun and can be a great way to educate users about big problems!

ACTIVITY: OCEAN PLASTIC CLEANUP GAME

Follow the video below to make a game where a diver will race against a fish to pick up plastic in the ocean.

This is what the game looks like when finished.

GREAT WORK!

You made a Scratch game and learned all about conditional blocks

What ways can you improve or add to the Ocean Plastic Cleanup game?

Try adding one new feature. Here are some suggestions:

  • Test if the diver “wins” the game by getting the health of the fish to 10.  
  • Adding more plastic sprites than just the bottle.
  • Have the plastic bottle “float” through the ocean.
  • Let the fish and the diver move in both directions – right and left.

What else can you add?

girls working at computer

Designing and Coding with Scratch

VARIABLES

Before you start coding, let’s learn about variables

There are times you need to keep track of different information inside your Scratch project. That is what variables are for.

You’ll be using variables in the Scratch project you will build in this lesson.

FIRST STEPS

scratch cat

PARTS OF THE DESIGNER

TIME TO TRY IT!

PARTS OF SCRATCH

Click on the orange i to learn about the highlighted parts.  Click on the arrows on the left and right to learn about other parts of the Scratch platform.

TIME TO TRY IT!

ACTIVITY 1: CODE THE RECYCLE GAME

Follow the video below to code the Recycle Game, or if you'd rather explore other tutorials, go to the Scratch Ideas page.
girl looking intently at laptop

Make a Scratch Project

One option for your Technovation project is to make a Scratch project to solve your problem.
 
Let’s get started by exploring the Scratch world and coding your first project!

ACTIVITY 1: EXPLORE SCRATCH

With the help of your parent or mentor, follow the video below to:
  1. Sign up for a Scratch account
  2. Do the Getting Started tutorial
  3. Try 2 or 3 other tutorials

SAVING YOUR PROJECT

When you make a cool project, you want to make sure and save it!

Give your project a descriptive name so you’ll know what it’s about.

Then Save Now under the File menu.

To see all your projects, click on the Folder next to your username.

If you click on a project, you will see the project page, where you can run the project.

Click See inside to edit the project again.

ACTIVITY 2: TELL A STORY

Choose one of the problems you and your team are thinking about solving. Make a new project and tell a story about the problem with Scratch.

Be creative! How will you tell people about the problem?

GREAT JOB!

Did you have fun coding in Scratch?

Excited to experiment more?

Check out the thousands of public projects on the Explore tab on the Scratch website. 

 

ADDITIONAL RESOURCES

You can also make your project using OctoStudio, a version of Scratch that runs on your phone.

It works a lot like Scratch, but has been designed so you can build and run your project directly on the phone.