Computer Science
Grade 5
20 min
Looks and Sound Blocks
Looks and Sound Blocks
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Use a variable to dynamically control a graphic effect like 'ghost' or 'pixelate'.
Create a conditional statement that changes a sprite's costume based on a score or user input.
Use a loop to create a smooth, timed animation sequence with multiple costumes.
Manipulate the pitch and pan of a sound using variables and mathematical operators.
Synchronize sound effects with visual changes using 'play sound until done' and 'wait' blocks.
Manage sprite layers ('go to front/back') to create visual depth in a project.
Have you ever wondered how video game characters change their appearance when they power up, or how the music gets more intense during a boss battle? 🎮✨
In this lesson, we'll go beyond b...
2
Key Concepts & Vocabulary
TermDefinitionExample
Graphic EffectA visual filter you can apply to a sprite, like 'color', 'fisheye', 'ghost' (transparency), or 'pixelate'. These can be controlled with numbers.Setting the 'ghost' effect to 50 makes a sprite 50% transparent.
Sound Effect (Pitch/Pan)A property of a sound you can change. 'Pitch' makes the sound higher or lower, and 'pan left/right' makes it sound like it's coming from one side.Using a loop to increase the 'pitch' effect by 10 each time will make a sound get higher and higher.
LayeringThe order of sprites on the Stage, determining which sprite appears on top of another. You can control this with 'go to front/back layer' blocks.To make sure a character always app...
3
Core Syntax & Patterns
Variable-Driven Effects Pattern
set [graphic/sound effect] to (my_variable)
Use this pattern to make an effect's strength depend on a variable. This is perfect for showing things like health, power, or score visually or audibly. For example, as a 'power' variable increases, you can make a 'brightness' effect increase too.
Conditional Appearance Pattern
if <(score) > 10> then
switch costume to [costume_name]
end
Use this pattern to make a sprite's look or sound change only when a specific condition is met. This is the key to making projects that react to the user or to game events.
Timed Animation Loop
repeat (10)
next costume
wait (0.1) seconds
end
Use this pattern to create a smooth animation. The 'repeat' block...
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
A script uses a variable 'i' in a loop: 'set [ghost] to 100; repeat (10) { set [i] to (i + 1); change [ghost] effect by (-1 * i) }'. If 'i' starts at 0, what is the visual effect?
A.The sprite fades in linearly (at a constant speed).
B.The sprite fades in with acceleration (fades in faster and faster).
C.The sprite fades out with acceleration.
D.The sprite flickers randomly.
Challenging
You have 3 sprites: Light1, Light2, Light3. You want to control them with a 3-digit binary number stored in a variable 'binary_lights', where 1 is on and 0 is off. If 'binary_lights' is '101', how would you write a script to turn on the correct lights?
A.if (binary_lights) contains 1, show all sprites.
B.script that checks: if letter 1 of 'binary_lights' = 1, show Light1. if letter 2 of 'binary_lights' = 1, show Light2. if letter 3 of 'binary_lights' = 1, show Light3. (And hides them if 0).
C.script that adds the digits of 'binary_lights' and shows that many sprites.
D.This is not possible to do with Looks blocks.
Challenging
A sprite is at the 'back layer' and has a 'ghost' effect of 50. Another sprite is at the 'front layer' and is fully opaque. What will you see on the stage?
A.You will see the front sprite clearly, and you will not see the back sprite at all.
B.You will see both sprites, but the back sprite will appear faded and 'behind' the front sprite.
C.You will only see the back sprite because it is transparent.
D.The two sprites will blend their colors together.
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free