Skip to content

Please update your browser

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

Transcript

Sometimes, 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.

Perfect.

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.

Tinker!

Change the wait time, and or make the sprite perform other actions while it's showing.

Choose an Add-On

What else?

Create and animate new sprites from the painting.

Easter Egg

Make sprites appear when the mouse is clicked.

Traveling Paintings

Make sprites change from one painting to another.

Weird World

Make the painting background twist.

Tell A Story

Create dialogue between sprites. You can tell a happy, funny, or even sad story about what’s really happening in your painting.

Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!