<<

Computer Project

Block Based Programming

What’s for Breakfast? https://scratch.mit.edu/projects/398972177/

By Madison Dragoo

Beginner Level Grade 3

My mom showed me a program that was created in a 4-H Scratch Class, and I thought the program was pretty neat. She told me our 4-H program was going to have a Scratch Class and I wanted to learn about coding, so I started going to an online 4-H Scratch Class.

After the first class I was able to create my own sprites. I liked moving the blocks over to make them move and talk on the computer. I could even pick different backdrops and make the sprites look like they were going places. I went to some more online classes and my mom helped me learn some of the different codes.

Here are the codes I learned:

• Sequence: This is where you put codes together in an order that makes the sprite move or have a conversation. I used this code a lot as the sprites move and talk.

• Loops: This is where you can use the Repeat code to make something happen over and over. I used a loop when Hedgie does his cartwheels.

• User input: This is where the person playing the game types information into the computer. Main Chick asks Chick Friend if he is eating birdseed and the user has to type an answer. • Variable: This is something that changes and can be almost anything. I used a variable for the answer when Main Chick asks Chick Friend if he is eating birdseed.

• Conditional: This is like a pathway where you can have different things happen which depend on something. I used this when Chick Friend answered whether he was eating birdseed.

• Iteration: This is a sequence inside a loop. An example is when the Main

Chick paces back and forth wondering what his breakfast is going to be.

I created my project. I tested it and made changes and tested it again. When I was done, I shared it and asked my dad to look at it. He said he couldn’t read everything the sprites were saying so I had to fix how fast the sprites talk. Then I shared the project again and my dad said it was better.

Please visit this website and help the chick find his breakfast.

https://scratch.mit.edu/projects/398972177/

What’s for Breakfast?

The main character in my story is a sprite called Main Chick. He wakes up in the morning and wants to find something to eat for breakfast. He walks out of the chicken coop and goes over to his friend on the farm and asks him if he is eating birdseed.

Then Main Chick goes for a walk and sees his friend Hedgie. Hedgie is practicing his cartwheels. He gets stuck on his back and asks Main Chick to help him.

Hedgie thanks Main Chick and asks if Main Chick wants to come to his house for breakfast.

Main Chick and Hedgie go to Hedgie’s house for breakfast. Hedgie leaves the room while Main Chick wonders what he will bring back for breakfast. Hedgie reappears with a bowl of fruit salad and sets it on the floor. Main Chick and

Hedgie then go to the fruit salad and have a wonderful breakfast together.

Main Chick

I chose a chick for my main sprite because they are cute and I wanted to use the

Farm as my backdrop. Main Chick appears in his coop at the Farm wondering what he can have for breakfast. He walks over to Chick Friend and asks him if he’s eating birdseed. I let the user answer the question and used a conditional code to ask another question if he wasn’t eating birdseed.

Then Main Chick goes for a walk and the backdrop changes to Blue Sky. He sees his friend Hedgie and wonders what he is doing. After Hedgie gets stuck upside down, Main Chick helps Hedgie get back on his feet. Hedgie asks Main Chick if he wants to come to his house for breakfast.

Main Chick and Hedgie leave. The backdrop changes to Room 1 which is Hedgie’s house. When Hedgie leaves to get breakfast, Main Chick paces back and forth as he wonders what’s for breakfast. I had to create a new costume for Main Chick so he could face the other direction when he paces. I used an iteration to get Main

Chick to pace three times before Hedgie comes back with breakfast. Then when

Hedgie sets the fruit salad on the floor, Main Chick goes to the fruit salad and changes costumes again so he can enjoy his breakfast.

I learned most of my coding with Main Chick. Moving the blocks to make him move and talk was fun. I didn’t know you could let the user type in answers to questions. What was really neat was how Main Chick would do something different if the user didn’t type “Yes” when Main Chick asked Chick Friend if he was eating birdseed. I learned how to create a new sprite by copying a sprite from one costume and flipping the image so that it faced the other direction to make a new sprite. Then at the end I finally figured out how to do an iteration code.

Coding for Main Chick sprite:

Coding for Main Chick sprite continued:

Hedgehog

The Hedgehog is named Hedgie because this is the name of my brother’s stuffed hedgehog. Hedgie is hidden until Main Chick leaves the farm and the backdrop changes to the Blue Sky. Then Hedgie appears as he is doing cartwheels. I made him do this by using a Repeat code that made him turn in circles. When Hedgie gets stuck on his back, he asks Main Chick for help. When Main Chick helps him, I used the Repeat code again to turn Hedgie back around so he is right side up.

I used more sequencing code as Hedgie and Main Chick talk and then go to

Hedgie’s house. When they get to Hedgie’s house, I used the Show and Hide code to make it look like Hedgie leaves to get breakfast and then comes back into the room.

The hardest part about coding Hedgie was getting him in the right place. I had to make a lot of changes to the x and y positions and how many times to repeat the Turn Left code. I learned that using different numbers of degrees in the Turn Left code made him go faster and slower.

Coding for Hedgehog sprite:

Coding for Hedgehog sprite continued:

Chick Friend

Chick friend uses a different costume because he is eating when Main Chick meets him. He only appears on the Farm backdrop and then hides for the rest of the story.

This was how I first learned to change costumes on my sprites and use the Show and Hide codes.

Coding for Chick Friend sprite:

Fruit Salad

The fruit salad that Hedgie brings out for breakfast is a sprite that is hidden until the backdrop changes to Hedgie’s house. Then the fruit salad has to wait until it is time for Hedgie to reappear and it goes with him into the room and then glides to the floor.

Coding for Fruit Salad sprite:

This part was really hard to get it to look right. The fruit salad would appear too late or it would look like it was floating in the air. After many tries, I finally got it to look like Hedgie was carrying it and putting it on the floor to eat.

THE END

THE END is actually sprites of letters. I used six different sprites and hid each of them until the very end when it was time for them to appear. I thought it would be neat to have each letter appear and spell out “THE END” so I set the wait time for one second more for each letter.

I learned that as long as you have the sprite hidden, you can set its position either before or after it waits to appear.

Coding for THE END sprites:

Coding for THE END sprites continued:

References:

4-H Online Scratch Class taught by Sam McCollum, 4-H Youth Development Floyd County Extension Educator

Example Scratch project: https://scratch.mit.edu/projects/385074250/

Getting Started with Scratch Guide https://cdn.scratch.mit.edu/scratchr2/static/__709da8e5f3d72129538a4ccdbcbf5 f2a__/pdfs/help/Getting-Started-Guide-Scratch2.pdf