Practice and reinforce the concepts from Lesson 8
Time needed: 30-45 minutes
What you'll do: Become a Scratch wizard by creating your own custom blocks! You'll make sprites spin, eat watermelons, explore space, draw amazing triangles, and even sing Old MacDonald's song - all using the power of functions! 🪄
✅ Make sure you're logged into your Scratch account
✅ Have your creativity hat on
✅ Ready to make some awesome custom blocks
✅ Remember: Functions are like magic spells - you create them once and use them many times!
Welcome, young coders! Today we're going to learn something super cool - custom blocks (also called functions). Think of them as your own special commands that you create!
💡 💡 What are functions? Functions are like recipes! You write the steps once, give it a name, and then you can use that recipe whenever you want!
Challenge One: Spinning Sprite 🌟
Watch this awesome tutorial to see what you'll create!
Your Mission:
Make a sprite do amazing spins using your very own custom block!
Step-by-Step Instructions:
Choose your star! Pick any sprite you like (maybe a dancer or a star?) and a cool background
Create your magic spell! Make a custom block called "spin around"
- Click on "My Blocks" in the blocks menu
- Click "Make a Block"
- Name it "spin around"
- Click OK!
Program the green flag to call your "spin around" function multiple times
- This is like telling your sprite to do the spin dance over and over!
Define what "spin around" does:
- Make your sprite turn 360 degrees (that's a full circle!)
- Add some color effects to make it extra cool
- Add a small wait so we can see the awesome spin
Test it out! Click the green flag and watch your sprite spin!
Blocks You'll Need:
scratchMake a Block (spin around) define spin around turn (360) degrees change [color v] effect by (25) wait (0.5) seconds ```tip
🎯 Pro tip: Try different numbers for the turn degrees and color effects to create unique spinning patterns!
Time to make a hungry sprite eat some delicious watermelon!
Create a fun eating animation using custom blocks with special inputs!
Set up your feast!
Create a smart custom block!
Program the green flag to:
Make the eating happen! In your "eat watermelon" function:
Test your hungry sprite! Try different sizes and speeds
Blocks You'll Need:
Make a Block (eat watermelon) with inputs
define eat watermelon (size) (speed)
glide (speed) secs to x: (watermelon x) y: (watermelon y)
play sound (Chomp) until done
change size by (-size)
hide
💡 🎮 Fun idea: Make multiple watermelons and have your sprite eat them all using a loop!
Challenge 3: Space City Exploration 🚀
Blast off into space and explore an amazing city among the stars!
Your Mission:
Build a space exploration game using multiple custom blocks that work together!
Step-by-Step Instructions:
- Build your space world!
- Add a cool spaceship sprite
- Create space buildings (towers, domes, stations)
- Add space objects (planets, asteroids, aliens)
- Pick an awesome space background
- Create THREE powerful custom blocks:
- "explore building" with input: "building type"
- "fly to location" with inputs: "x position" and "y position"
- "scan object" with input: "object name"
- Program the green flag to:
- Set up your spaceship's starting position
- Start the exploration adventure!
- Make each function special:
- explore building: Make your ship say what it found
- fly to location: Smoothly move your spaceship
- scan object: Check what you're touching and report findings
- Connect everything! Use broadcasts to make sprites talk to each other
Blocks You'll Need:
scratchMake a Block with inputs define explore building (building type) define fly to location (x position) (y position) define scan object (object name) broadcast (found something!) when I receive (found something!) if <touching [Space Tower v]?> then say (Wow! A space tower!) for (2) seconds __CODE_BLOCK_3__`
🌟 Space tip: Use the "touching" block to detect when your spaceship reaches different locations!
Want to make it even cooler? Try these:
Become an artist and draw amazing triangle patterns with custom blocks!
Create beautiful triangle art using the power of functions and the pen!
Set up your art studio!
Create THREE artistic custom blocks:
Program the green flag to:
Make your triangle functions draw:
Create art! Combine your functions to make amazing patterns
Blocks You'll Need:
Make a Block with inputs
define draw triangle (size) (color)
pen down
set pen color to (color)
repeat (3)
move (size) steps
turn (120) degrees
pen up
💡 🎨 Art tip: Remember, a triangle has 3 sides, and turning 120 degrees three times makes a perfect triangle (3 x 120 = 360)!
🏆 Extra Art Challenges!
Ready to be a geometry master?
- Create a "draw square" function
- Make a "draw star" function
- Let users pick colors with ask blocks!
Challenge 5: Old MacDonald Song 🎵🐮
Create your own musical farm show with functions!
Your Mission:
Build a singing farm where functions help Old MacDonald perform his famous song!
Step-by-Step Instructions:
- Build your farm cast!
- Add Old MacDonald sprite
- Add farm animal sprites (cow, pig, duck, horse, sheep)
- Choose a nice farm background with a barn
- Create THREE musical custom blocks:
- "sing verse" with inputs: "animal name" and "animal sound"
- "play chorus" (no inputs needed)
- "animal appears" with input: "animal type"
- Program the green flag to:
- Welcome everyone to the farm
- Start the musical show!
- Make your functions perform:
- sing verse: Make MacDonald sing about each animal
- play chorus: Sing "E-I-E-I-O!"
- animal appears: Show the right animal and make it move/sound
- Put on a show! Call your functions to perform the whole song
Blocks You'll Need:
scratchMake a Block with inputs define sing verse (animal) (sound) say (join (Old MacDonald had a ) (animal)) for (2) seconds say (join (And on his farm he had a ) (animal)) for (2) seconds play sound (sound) until done broadcast (show animal) define play chorus say (E-I-E-I-O!) for (1) seconds ```tip
🎭 Performance tip: Use the "join" block to combine words with your input values. This makes your song work with ANY animal!
Want to create a blockbuster farm show?
Wow! You've learned how to create custom blocks (functions) in Scratch! You made sprites spin, eat, explore space, draw art, and even sing! Functions are super powerful - they help you organize your code and do amazing things with less work.
Show off your amazing creations!
Submit your Scratch links here
Remember: The best coders are creative coders. Keep experimenting with functions and see what incredible things you can create! 🌟