This week I decided to make a game that gives the user choices. In order to decorate the egg, we give the user a few choices of colours and stickers to put on the Easter Egg and the user must click on the colour and sticker they like. We had to import sprite images from the internet, draw some of our own sprites from scratch and get sprites from the library. In the beginning after the green flag is clicked, I used the SAY block to give instructions that disappeared after 10 seconds.
We found an EGG, CHICK and BUNNY cartoon image on the internet and saved them to an image file on our desktop. I clicked the Add Sprite From File and found these images on my desktop and added them as new SPRITES. I then cleaned up the background of these sprites and made it transparent.
I drew a Spot SPRITE that I moved over on top of my egg to make it look good and I drew a Stripe SPRITE that roughly fell on top of the egg. You can move, shrink and grow each of these sprites so that they look OK on the egg. Now we have to get the BUTTON SPRITES on the side and the PAINT BALL SPRITES on the bottom. I started with one button that I found in the library and imported it. I changed it’s colour and wrote the word SPOTS on it in it’s costume editor using the T button. Here are what my sprites looked like:
And the STICKER SPRITES (the chick, bunny, spots and stripes) respond to each BUTTON broadcast by SHOWing or HIDEing. As each sticker called that one SHOWS and the others all HIDE. Here, this is the script for the SPOTS SPRITE. See how there is only one SHOW block under the WHEN I RECEIVE SPOTS sprite. This SPOTS SPRITE will only SHOW when the SPOTS BUTTON is clicked and sends out the broadcast SPOTS. When any other sticker button is pressed, it will hide.
The CHICK SPRITE will look exactly like this, except that the SHOW block will be under the WHEN I RECEIVE CHICK block! The PAINT BALL SPRITES do the exact same thing. They send out a broadcast, when clicked, that tells what colour the user picked. The SAY block helps let people know what to do.
The EGG must now react to the broadcast. We need to add a new the EGG SPRITE costume that matches the colour of the paint ball and rename the costume to orange. After I added the new costume, I put the WHEN I RECEIVE orange, CHANGE COSTUME TO ORANGE. The same happens for each other coloured PAINT BALL SPRITE.As you add buttons for other decorations on the egg, create or import the decoration and then script them as we have done above for the SPOTS. My final project is on the SCRATCH.MIT.EDU website. Search for projects for the username:cdathenry1516. I will share it so you can play, change the scripts or downlod it to your own computer. Have fun!