Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
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.
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.
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.
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.
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.
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.