Skip to content

Please update your browser

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

arrow_back Easter Egg Surprise

Transcript

Surprise your friends by adding a color to your art piece that plays a funny sound when touched.

Surprise features that are hidden in a computer program like this are called Easter eggs.

To get started, add a new color to your pattern sprite that will only show up once and a while.

Select the pattern sprite and go to the costumes tab.

Pick a new color to add as your Easter egg.

This example uses red.

Then, make a tiny dot somewhere on your costume.

Test your code to see how often this Easter egg color appears.

You should be able to see your new color but it should be less noticeable than the other colors.

Next, add color that will make your yellow x sprite play a surprising sound when it touches the new color in your pattern.

Select the yellow x sprite and navigate to view your code.

So far your code tells your sprite to play a note if it touches the original colors you selected.

Now, you need to add this code for your new Easter egg color.

Drag out an if then block from the control menu and place it at the bottom of the forever loop in your code.

From the sensing menu drag out a touching color block and place it in the conditional notch of the if then block so it reads if touching color then.

Click on a color inside this block then click on the new Easter egg color in your project.

What surprising sound is your Easter egg gonna play?

To choose one go to the sounds tab and select the sound from the audio library.

This example uses the sound Dog1 which is just a dog barking.

(dog barks)

Once you find a sound that you like, click to add it to your Easter egg color.

Finally, add the code to the conditional to play your Easter egg sound.

Click on the sound menu, drag out a play sound block and place it inside the conditional for your Easter egg color.

Make sure you have selected your new sound from the dropdown menu of the play sound block.

Time to test your code.

Click the green flag and move the mouse over your new Easter egg color.

Did you hear your new sound play?

(piano music)

(dog barks)

Great job.

Now it's your turn.

Add a new Easter egg color to your pattern sprite and add a conditional statement to your yellow x sprite so it plays a surprising sound when it touches the Easter egg color.

Choose an Add-On
Change Instrument and Tempo
Change instruments and tempo in your musical art piece when the yellow X sprite touches different colors.
Make it Melodic with a Chord
Make your project play chords, not just individual notes.
Easter Egg Surprise
Add a surprise color to your art piece that plays an unexpected sound when touched.
Sprite Trail
Add a graphic effect that makes the yellow X sprite leave a color-changing trail across the screen.
arrow_backward Back
Next arrow_forward
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!