Skip to content

Please update your browser

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

2. Your Home Will Be...


The Imaginator flashes different possibilities for your friend’s future and chooses one when he or she presses the spacebar.

This video will guide you through the steps.

Click on the sprite named “home.”

From the looks menu, drag out a “next costume” block.

Click on this block to see what it does.

The home sprite changes!

This is because the sprite has many “costumes.”

To see the different costumes, click on the “costumes” tab, then flip through them.

The program should repeat cycling through different homes until your friend presses the spacebar.

That’s where the loop comes in!

A loop makes something in your project repeat over and over.

You can find loops in the “control” menu.

For today’s project, the program should repeat showing the next costume until your friend presses the spacebar.

So, drag out the “repeat until” block.

Place it around the block that should repeat - in this case, “next costume.”

Click on the code.

The sprite cycles through lots of different homes quickly.

Next, tell the program when to stop running the loop.

Note the gap after the “repeat until” block.This is where the “condition” that stops the loop goes, making the homes stop cycling when the spacebar is pressed.

Select the “key pressed” condition from the “sensing” menu, and place it in the gap in the “repeat until” block.

From the dropdown menu, select “space.”

The homes keep changing, but now they stop when the spacebar is pressed.

Click on the code to test it.

From the events menu, add a “when flag clicked” block, so the code will run when your friend presses the green flag.

Test your code.


When the flag is clicked, the program runs.

Now, it’s your turn: Change the home sprite’s costume using the “next costume” block.

Make the costume keep changing with “repeat until” and “key pressed” blocks.

Add a “when flag clicked” block.

arrow_backward Back
Next arrow_forward
  1. Change the home sprite's costume with the "next costume" block.
  2. Make the costume keep changing with "repeat until" and "key pressed" blocks.
  3. Add a "when flag clicked" block.