Please update your browser
Your browser version is not supported by this site. CS First may not work properly. Learn more.
In this video, you'll program the object
that the player is looking for to appear
in only one location.
To start, choose what your sprite is looking for.
Click the object sprite, then go to the Costumes tab.
There are a few different choices available.
Choose one of these items
or add a different object from the Costume library.
What might your character need to find?
Once you've chosen an object, click Looks,
and drag out Show and Hide Blocks.
The Show block should run when the backdrop changes.
Click Events, and drag out a When Backdrop Switches block.
Click the dropdown and select the name of the location
where your object will appear.
This example uses the cave,
but you will choose your own location
for the object in your game.
Then, drag another When Backdrop Switches block
onto the Hide block and select Town.
Click the flag to try it out.
Move the sprite to the location you just selected.
The sprite appears.
Next, program a winning condition that will happen
if the player sprite touches the object.
Place a Forever loop and an if statement
under the Show block.
Add a Touching block from Sensing
and select Character from the dropdown.
Create a winning celebration.
You might play a sound or use a Say block to say,
"Yay! You win!"
Move the sprite until it finds the object and...
Now it's your turn.
Select the object sprite
and a costume from the Costumes tab.
Show the object in one location
using When Backdrop Switches and Show blocks.
Hide the object at the start of the program
using When Backdrop Switches and Hide blocks.
Program a winning condition
using Touching, Forever, and If blocks.
In the next video, you'll add more storytelling elements
to make your game more exciting.