Scratch Programming Intro
Mini Tasks Shrink all of the apple sprites to 27x27 (or close to it) using the ‘Costumes’ tab for each. Add a second red apple. Now you should have three apples total. Change the speed that the apples are dropping. You can reset this to -5 before you move on, if you want.
Task One Make the ‘You won!’ score greater than 12 Add a ‘bad apple’ sprite. Make a new sprite by duplicating the apple sprite. Color it black. Make the program wait until the score is greater than 5 before the bad apple shows up. Program the bad apple so that if it hits the bowl, you lose. (There are two hints how to do this on the next slide. You can either try it yourself, or read the next slide.) Design a new sprite that says ‘You lose!’ and make it appear. Give it a different sound than the popping sound.
Hint for Task One For #4 of task one, you can do either of two ways (or more): Make a new variable. Call it bad apple. Set it equal to 0 right after ‘set score to 0.’ Then, if the apple touches the bowl, set it to 1. In the script for the ‘You lose!’ sprite, let it ‘show’ if ‘bad apple’ = 1. In the ‘Events’ scripts is a block, ‘broadcast message 1.’ When you broadcast this message, it can be received by other scripts. So if ‘bad apple’ touches the bowl, you can ‘broadcast message 1.’ In the ‘You lose’ sprite, you can use the ‘When I receive message 1’ block to tell ‘You lose!’ when to ‘show.’
Task Two – Frog Detractor Add a new ‘frog’ sprite. Position him to sit on the tops of the grass mounds (just drag him up there). Add a second ‘frog’ costume that is the mirror image of the first. First, right click on the frog using the costume tab and select duplicate. Then, using the ‘flip left-right’ function in the top right corner, flip the image.
Task Two – Frog Detractor When the start is selected, we want the frog to go back and forth across the screen. If we keep checking his ‘x position’ we can tell him which way to go. If it’s greater than 240, , we need him to turn and go left. If it’s less than -240, , we need him to turn and go right. Set up those two ‘if’ loops in a ‘forever’ loop, similar to the way you set up the ‘forever’ and ‘if’ loops for touching the bowl, except you’ll have two ‘if’ loops (one for each inequality).
Task Two – Frog Detractor Make a new variable named direction. If the x position is greater than 240, we need the frog start going in the negative direction, so ‘set direction to -1,’ after that inequality. If the x position is less than -240, we need the frog to start going in the positive direction, so ‘set direction to 1,’ after that inequality. When ‘direction’ is -1, the frog’s tongue should be pointed left, so get the block ‘switch costume to frog2’ in the ‘Looks’ tab and drag it into the correct ‘if’ loop. When ‘direction’ is 1, the frog’s tongue should be pointed right, so get the block ‘switch costume to frog’ in the ‘Looks’ tab and drag it into the correct ‘if’ loop. Within the ‘forever’ loop, but after both of the ‘if’ loops, use , to get the frog to move correctly.
Task Two – Frog Detractor Now make the red and bonus apples (but not the bad apple) reset to the top of the screen if any of them touch the frog. This script is similar to touching the bowl, except instead of adding to score, you’re going to ‘go to random position’ and ‘set y to 180.’ You will need to do this in each of the apples’ scripts.
Save your work In the top left of the ribbon, select ‘file’ and then ‘Download to your computer.’ Change the ‘Save in’ directory to your P: drive and the ‘File name’ to your last name and frogscratch, for example ‘Lennon frogscratch’ or ‘Brown frogscratch.’