Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more


In this video, you’ll learn how to make it look like the character is moving towards or away from the door. Start by programming the character to move.

Drag out a “move ten steps” block. People don’t walk without moving their feet.

Several Scratch sprites come with different costumes that make it look like they are walking the way people do.

To check if the sprite you chose is one of them, click on the costumes tab. This example uses the Scratch cat, who can switch between these two costumes to look like it’s walking.

If you did not choose a walking sprite for your story and you would like one, click on “choose new sprite from library,” then the walking menu. To copy your code from one sprite to another: Now, you can get rid of the old sprite and use a walking sprite instead. To make use of the walking costumes, you need to switch between them. To do that, go back to the scripts tab. Click on the looks menu, and find the “next costume” block. Click on it to switch costumes.

To keep switching costumes without clicking the block over and over, place it inside a repeat loop. To move while switching costumes, place the “move” block inside the repeat loop as well. Test the code. Now, it looks like the character is walking as it moves in a direction. But, you want the character to walk toward the door and go through it if a certain condition is met. To make that happen, Place the code below “if answer = yes” and above “switch backdrop to.” Test the code.

If you answer “should I go through the secret door” with “yes,” the sprite should walk towards the door. It does. If the answer is “no,” the sprite should move in the other direction. The code to make the character walk in the other direction is the same, so duplicate the walking code you made already.

Before the character walks, though, it needs to change direction. That is where the “point in direction” block comes in handy. “Point in direction 90” faces the sprite right. You want the sprite to walk left, away from the door. Place the “point in direction” block above the copied walking code. Click on the dropdown, and switch it to negative 90. That should point the character in the opposite direction. Click on the block to test it.

Wait! The main character is upside down! That is because of how the character is rotating, or turning. The “set rotation style” block will fix this.This sprite should only turn left or right. Click on the dropdown menu, and select “left right.” Now, click on the block. The character should only face left or right. You’ll notice that it turned right-side up. To make sure it stays that way, place this block at the beginning of this character’s code, just below “when green flag is clicked.”

Place the walking code in the “else” section of the “if answer = yes” block. Test your code again. Try saying “no” when the code asks if you want to walk through the door. The character should walk away from it. Then, try the code, but enter “yes” instead.

What!? The character still goes left. This is because the character continues to move in the direction it was last told to go. To make the character move right, place another “point in direction” block above the walking code in the “answer = yes” section. Click on the dropdown menu to make sure it is telling the character to go right.

Test the code by clicking on the green flag. Type “no” first, and watch the character walk left. Then, type “yes,” and watch the character move right. Nice job!

So you can control where the character goes, it should always start in the same spot. Pick a spot where you want the character to start, and drag your sprite there. Then, place a “go to x y” block under the “when green flag clicked” block so that the character will always start in that spot. Test your code by clicking the green flag. It works!

Tinker with the values in the “move” and “repeat” blocks to change how far the character moves.

Choose an Add-On
In this video, you’ll learn how to make it look like the character is walking towards or away from the door.
What's the Password?
In this add-on, you'll program a secret password that the user must enter to travel through the secret door.
Make it Rain
In this add-on, you'll learn how to use the backpack to add the rain from your day 3 project into this project.
Find the Secret Door
In this add-on, you'll program the main character so the audience can use the arrow keys to find the secret door.
Add Another Character
In this add-on, you'll add more characters to your story.
Add Another Scene
In this add-on, you'll be prompted to add another scene, and given some ideas about how to program it.
arrow_backward Back
Next arrow_forward
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!