In this video, you will program your object to bounce around the screen.

This will create an unusual behavior for the object your characters discover.

To start, click the object sprite.

From the motion menu, click, hold and drag out a “glide random position” block.

When you click this block, the object glides for 1 second to a random spot on the stage.

Next, program the computer to repeat this action. Select the “Control” menu.

Click, hold, and drag out a “repeat” block. This block makes the code inside it run multiple times. Place it around the block stack, and click to run.

To make the sprite bounce faster and longer, tinker with the values in the glide block and the repeat loop. This example uses zero point 5 in the glide block, so the object glides to a random location ten times really fast!

There’s a bug, or error, in this code though. After the repeat loop finishes running the code, the object is stuck in a random place on the stage. To fix this, use a “go to x y” block. This block makes the sprite go to a specific position. When you drag it out, the values are set to the current position of the sprite.

Drag the sprite to where you want it to be on the stage after it finishes bouncing.

Then, click the motion menu and add a “go to x y” block to the bottom of this code stack.

Click the code stack to test this. Great. Feel free to make your object move to a special place in your program to help tell your story. Finally, program this block to run when the sprite is clicked. From Events, add a “when this sprite clicked” block. Try it out!

Add “say” blocks to your character sprites to tell your audience to click the object to see what it does. This helps your audience feel like they are part of your story.

Now, it’s your turn! Select the object sprite.

Add a “glide random” block and a “repeat” loop.

Add a “go to x y” block to make the sprite move to a specific position when it stops bouncing. Add an event, like “when this sprite clicked.”

Then, return to this page to select another video to try.

Choose an Add-On

Start here
Continue the Conversation

Add code to both character sprites to continue their conversation.

Code a Color Change

Make the object change colors.

Add Mystery with a Pulsing Object

Make the object grow and shrink repeatedly to look like a pulse.

Add Sounds to Your Story

Add sound to the story when the characters discover the unusual object.

Make Your Object Bounce

Code the object to bounce around the screen.

Paint Your Own Animation

Use the costume editor to customize an animation.

Animate a Story Title

Build a title card for the project and animate it before the story begins.

Let the Audience Decide

Ask the audience a question and make something happen based on the response.

Add an Object

Add another object to the story to create more action.


Para hacer esta actividad en español, haz clic aquí.


  1. Watch the introduction video.
  2. Open an 'adventure' project link below and add characters and dialogue.
  3. Return to this page and watch more videos below.


  1. Visit the Hour of Code teacher resource page for instructions.