Skip to content

Please update your browser

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

Choose an Add-On
play_circle_filled
Flicker
Program an interesting introduction to your project.
arrow_forward
play_circle_filled
Vector Characters
Learn about vector graphics, and edit or draw your own costume.
arrow_forward
play_circle_filled
Bitmap Characters
Learn about bitmap graphics and draw your own pixel character.
arrow_forward
play_circle_filled
Adding Sound
Add video game sound effects or music to your project.
arrow_forward
  • 1. CS First Survey
  • 2. CS First and Scratch Overview
  • 3. What is Computer Science?
  • 4. Choose a Character
  • 5. Tell a Story
  • 6. Add-Ons
  • 7. Reflection
  • 8. Wrap-up: Gaming Story
  • 9. Wrap-up: Share Your Project
  • 10. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

Game introductions often include a short animation, special effect, or other interesting features to get people excited about playing the game. In this add-on, you'll program a flickering background to introduce your project.

To start, click on the scripts tab. You’re creating an introduction, so the transition sprite should show when the project starts. Drag out a “when flag clicked” block from the events menu, and add a “show” block from the looks menu. Click the flag to test.

Great! The “transition” sprite shows. Next, create the flicker effect by switching quickly between two costumes.

Drag out a “switch costume to” block. Select the costume name of the effect you want to show. Drag out another “switch costume to” block, and select the second costume name. Click each of these blocks repeatedly to make the flickering effect.

Rather than repeatedly clicking between these blocks, you can program the computer to repeat this code for you.

Select the control menu, and drag out a “repeat 10” block. Place the “switch costume” blocks inside it. If you run this code now, nothing happens. The computer runs the code so fast, you can’t see the sprite change costumes. To fix this, add a “wait” block after each “switch costume” block. Click the flag to test. To speed up or slow down the flickering effect, change the values in the “wait” blocks.

Next, make the flicker effect fade out. Drag out a “change effect by" block. To fade the sprite, select “ghost” in the dropdown. Click the block to run it. The sprite becomes slightly more transparent. To keep fading the transition until the transition sprite disappears entirely, add a “repeat 10” block, then attach this code to your block stack. Click the flag to try it. Cool, now the introduction fades into the project! You can change the speed of the fade by tinkering with the values in the “repeat” and “change effect” blocks. If the sprite doesn’t completely fade out, add a “hide” block at the end of your block stack.

Next, program the rest of your code to start running after the effect fades out. For each “when flag clicked” block in your program, add a “wait” block with the amount of time your introduction takes. Try different values in the “wait” block until your story starts at the right time.

In computer science, it often takes more than one try to find the right solution to a problem.

Keep coding, testing, and trying solutions until you find the one that works.

Now, it’s your turn: Start an effect to introduce your game with “when flag clicked” and “show” blocks. Create a flickering effect using “repeat” and “switch costume” blocks Make the flicker effect fade out using “repeat” and “change ghost effect” blocks. Start your story after the introduction by adding “wait” blocks after each “when flag clicked” block.

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!