Skip to content

Please update your browser

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

Transcript

One way to animate sprites in your logo is to make them move.

In this video, you will program letters to randomly move across the screen.

To start, select a sprite to program.

This example uses the letter “G,” but use any letter you'd like.

Next, set an ending position.

This will return the letter to its original spot after it moves.

Select the “Motion” menu.

Then click, hold, and drag out a “go to” block.

This block moves the sprite to a specific position.

When you drag it out, the values are set to the current position of the sprite.

Add an event to tell the computer when to run this code.

Select events and add a “when flag clicked” block.

If you move the sprite, then click the flag, the sprite moves back to its original position.

Next, program the sprite to move to a random position.

Select the “motion” menu.

Drag out a “go to mouse pointer” block, and place it between the blocks.

Change the value to “random position.”

Click the flag to try it out.

Nothing happened?

When you click the flag, the sprite goes to a random position, then immediately goes back to the position you set.

This happens so fast, you can’t see it.

To fix this, add a “wait” block from Control between these blocks.

Click the flag a few times to try it out.

Great!

Each time you click the flag, the sprite goes to a random spot on the stage, waits, then returns to its original position.

Next, make the sprite repeat this action.

Select control, and add a “repeat 10” block around the code.

The “repeat” block is a type of loop.

It runs the blocks inside 10 times.

Click the flag to try it out.

To speed this up, change the value in the “wait” block to something smaller, like point one.

Tinker with the value in the “repeat” block to change the number of repeats.

Alright!

Next, program the other letters.

Click, drag, and drop this code onto each of the other sprites.

Before running this program again, replace the “go to” block for each sprite.

This will set each sprite to its own unique ending position.

Click the flag try it.

If any sprites didn’t return to the correct position, drag them to where they should have ended, and replace the “go to” blocks.

Woo-hoo!

Now it’s your turn: Select a sprite.

Add “go to” and “when flag clicked” blocks to set an ending position.

Add “go to random position” and “wait” blocks to move the sprite.

Add a “repeat” block to repeat this action.

Copy this code to the other sprites, and replace the “go to” blocks.

Once you finish these steps, return to this page to select another video.

Choose an Add-On
Switch Costume
Change the style of a letter each time it's clicked.
Say Something
Tell a story with talking letters.
Add Backdrop
Add an image behind the logo.
Change Color
Create an interactive logo by changing letter colors when a key is pressed.
Edit, Draw or Add Letters
Edit, draw, or add an image to change how a letter looks.
Chase
Turn your logo into a game where a letter chases the mouse pointer.
Change Scene
Add a button that changes the scene behind your logo.
Spin
Make a letter spin.
Jumble Letters
Make your letters randomly move across the screen.
Disappearing Sprites
Play a sound as a letter disappears.
Dance Whirl
Make your letters whirl to music.
Bouncing Sprites
Animate your letters to make them bounce.
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 Valentine's Day logo.