Skip to content

Please update your browser

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

arrow_back Bounce Everywhere

Transcript

Now, you will program a letter to bounce all around the screen.

This kind of animation can show the personality of the name you choose, or just be fun!

To start, add a new sprite to your project.

Scroll through the library of available sprites until you find the letter you need.

Click on the sprite to add it to your project.

This example uses the letter “A,” but you will add a sprite for the name you are animating.

Then, code the sprite to move.

On the scripts tab, select the “motion” menu.

Click, hold, and drag out a “move” block.

Click the block to see what it does.

The letter moves ten steps.

To make this sprite move more, change the value in the “move” block to 30.

Click the block again to test it.

Not bad, but if the sprite is going to bounce off the edges of the stage, it needs to move more.

Try a value of 100.

Click the block to test.

That’s better!

Next, make the sprite move more than once without having to click the block.

Click the “control” menu, and drag out a “repeat” block.

Place it around the “move” block.

The “repeat” block runs the blocks inside it a specific number of times.

To increase how many times the sprite moves, type a larger value in the “repeat” block.

Click the block stack to see what happens.

The sprite moves, but it moves all the way to the edge of the stage, then stops.

To make the sprite bounce, click the “motion” menu, then drag out an “if on edge, bounce” block.

Place it inside the “repeat” block, under the “move” block.

Click the block stack to see what happens.

The sprite bounces back and forth between the right and left edges of the stage. And flips upside down and right side up.

Next, make the sprite change direction to bounce randomly around the stage, instead of just flipping back and forth.

From the motion menu, drag out a “point in direction” block.

Snap it to the top of your block stack.

Next, click the operators menu.

Drag out a “pick random” block, and place it in the variable space on the “point in direction” block.

Change the values in the “pick random” block to 1 to 180.

These values represent the area of the entire stage.

Click the block stack a few times to see what happens.

The sprite bounces around the stage!

But, every time you click, the sprite stops its bounce in a random area of the stage.

To make the sprite return to its starting position after it bounces, click the “motion” menu, and find the “go to x, y” block in the menu.

Don’t drag it out yet.

Click on the sprite, and move it to its correct ending position.

The values in the “go to x, y” block automatically update to match the sprite’s position.

Drag out the “go to x, y” block, and snap it to the bottom of your block stack.

Click the block stack to test.

The sprite bounces all around the stage, and it ends in its correct position in your project.

To make the sprite finish the animation facing upright, from the “motion” menu, drag out a “point in direction” block.

Snap it to the bottom of your block stack.

Click the block stack again.

The sprite bounces all around the screen, returns to the correct position, and ends up facing upright.

What a great animation!

If your animation didn’t work as expected, keep trying!

Next, make this animation run when the sprite is clicked.

From the “events” menu, drag out a “when this sprite clicked” event.

Attach it to the top of your block stack.

Click the sprite.

The letter bounces all around when you click it!

Now someone can use the code you created simply by clicking the letter.

Now, it’s your turn: Add a new sprite to your project.

Add a “move” block, and change the value.

Add a “repeat” block, and change the value.

Add an “if on edge, bounce” block.

Add a “point in direction” block.

Add a “go to x, y” block.

And add a “when this sprite” clicked event to the top of the block stack.

Once you finish these steps, return to this page to select another add-on to try.

Choose an Add-On
Change Color
Change the color of a letter when it’s clicked.
Grow and Shrink
Change the size of a sprite when it’s clicked and add a sound to match the animation.
Draw a Letter
Draw your own letter and make it move.
Spin
Add a letter and rotate it when it’s clicked.
Bounce
Move the sprite up and down and add a sound as it bounces
Wave
Create and change to different costumes.
Bounce Everywhere
Move the sprite all around the stage, then make it return to a specific point.
New Backdrop
Switch to a different backdrop by clicking the letter or sprite.
Say Something
Make the letters talk to each other when the green flag is clicked.
Sprite Dance
Make a sprite dance when the sprite is clicked.
Add Background Music
When you click a sprite, play a song and change the background
Play a Beat
Play a drum beat when the sprite is clicked.
Next arrow_forward
Instructions
  1. Watch the introduction video.
  2. Open the Starter Project below.
  3. Return to this page and watch more videos to customize your project.