Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
Doodles can be illustrations, animations, and sometimes even games.
In this video, you will turn your logo into a chase game.
In this game, a sprite follows the mouse pointer.
If it touches another sprite, a sound plays.
To start, select a sprite to chase the mouse pointer.
This example uses the letter "G," but you can use any sprite you'd like.
Next, program this sprite to point towards the mouse pointer.
Select the Motion menu.
Click, hold, and drag out a "point towards" block.
To make the block run repeatedly,
add a "forever" block from the Control menu.
The "forever" block is a type of loop.
It runs the code inside forever,
or until you click the stop sign.
Click the block to see what it does.
As you move the mouse pointer,
the sprite changes directions.
Next, program the sprite to move forward.
Select the “Motion” menu.
Add a "move 10 steps" block inside the "forever" block.
Click to try it out.
The sprite points and moves towards the mouse.
Click the stop sign.
Next, program the sprite to play a sound when it touches another sprite.
From the Control menu,
Click, hold, and drag out an "if" block.
The “if” block runs code “if” something happens.
In this example, the code runs if the sprite touches the color green.
You can use any sprite color you like for your project.
To make this happen, select the “Sensing” menu.
Click, hold, and drag out a “touching color” block, and add it to the “if” block.
Click the color swatch in the “touching color” block,
and click a letter to choose a color.
To make the sprite keep sensing the color you choose, select the “control” menu,
and drag out a “forever” block.
Place it around the “if” block.
Next, make a sound play if the sprite touches the color green.
Select the “Sounds” tab.
Choose a sound from the library.
Then, select the “Scripts” tab and the “Sounds” menu.
Click, hold and drag out a “play sound until done” block, and add it inside the “if” block.
Finally, select the “Events” menu,
and add a “when flag clicked” block to both block stacks.
This block runs the code when you click the flag at the top of the stage.
Try it out!
You did it!
If the G sprite touches the color green, a sound plays!
To make your game more challenging, rearrange the sprites to create obstacles.
Now it’s your turn:
Select a sprite.
Inside a forever loop, add a “point towards” and “move” block.
Inside another forever loop, add an “if,” “touching color,”
and “play sound until done” block.
Add a “when flag clicked” block to both block stacks.
Once you finish these steps, return to this page to select another video.