Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
programmers leave special surprises for users to discover.
These are called Easter eggs.
This video will show you how to make your own Easter egg
to surprise your users.
First, pick a sprite to hide in your picture.
Click on Choose Sprite from library.
This example uses a bird.
Feel free to change the size of the sprite
and move it to the part of the painting
that the user will click on.
For this example,
the bird will show up when the window is clicked.
This won't be much of an Easter egg,
if users see the sprite immediately.
So you need to make it hide at the beginning of the program.
Usually, you would use a hide block to conceal a sprite.
In this case, however, the user still needs
to be able to click on the sprite,
and you can't click a sprite you can't see.
Instead, use the ghost effect.
Find the block that says set color effect to
in the Looks menu.
Click on the dropdown menu and select ghost.
Then, drag the block into the blocks area.
Now, the block will change transparency of the sprite
rather than its color.
The number in the block
determines the sprite's transparency.
100 would make it completely invisible.
You want a number that makes it mostly hidden, like 99.
Click on the block to test it.
The sprite hides.
To ensure this always happens at the beginning
of your program, place a when green flag is clicked block
above the set ghost effect to block.
Next, program what should happen when the sprite is clicked.
First, make the sprite appear again.
To make that happen,
drag out another set ghost effect to block,
but don't connect it to the first one.
Set the ghost effect to zero.
Click on the block.
The Easter egg sprite should reappear.
You only want this sprite to appear for a short time.
Place another set ghost effect to block
under set ghost effect to zero.
To hide the sprite again, set the ghost effect to 99.
Click on the stack of blocks.
The sprite hides but, wait,
when you click on the stack of blocks again,
it looks like the sprite stays hidden.
That is because the computer executes the code very quickly.
The code reads show, then hide the sprite,
which doesn't give the user enough time
to see the sprite when it appears.
To fix this bug, add a wait block
between the two set ghost effect to blocks.
Click on the stack again to test.
The sprite should appear,
stick around for a short time, then disappear.
Tinker with the value in the wait block
until the sprite stays visible
for a length of time you like.
The sprite should show itself, then hide again
when the user finds and clicks on it.
So place a when this sprite is clicked block
at the top of your code stack.
Finally, you can add more things
that the sprite can do while it's visible.
In this example, the bird plays a sound.
You can make your sprite moo, spin, talk,
or anything your imagination can come up with.
Now it's your turn.
Add another sprite,
make it hide when the green flag is clicked,
using the ghost effect.
Make the sprite show itself, wait,
then hide again when it is clicked.
Change the wait time,
and or make the sprite perform other actions
while it's showing.