Name: Daniel Harris
Period: 7
Assignment: Lab #2
This lab focused on loops and repition in Scratch. We learned about forever loops and repeat loops, and how they affect the code we run inside them. Loops can be useful when you want something to happen in increments, or if you want your program to do the same thing without writing it out multiple times. The different types of loops included forever loops, repeat _____ times loops, and repeat until loops, to name a few. Click HERE for the full description.
My first problem was to make a regular hexagon with repeat commands, so I began by creating a sprite that was a horizontal line segment below the center of the sprite canvas. I then used the stamp command, which leaves behind a copy of the sprite, in combination with a turn sixty degrees command. Both of these commands were inside a repeat 5 times command to make a regular hexagon when the green flag is clicked.
The second problem was to decide which loop structure would result in a sprite moving 100 steps. The loop structures included; a move 10 steps in a repeat 10 times, a move one step within a repeat 10 times within a repeat 10 times, a move 5 steps within a repeat 16 times after a move one step, all inside a repeat 20 times, a move 1 step within a repeat 20 times preceding a move 5 steps repeated 16 times, and a move 10 steps within a repeat 10 times in a repeat forever. To solve this I made 6 cats, one of them moving 100 steps (the bottom cat) and I started all at the same x coordinate to see which ones stopped at the same spot.
>The final problem I did was to create a program that broadcasted a message and began another animation after receiving the broadcast. To do this I created two main sprites, one was a plane that begins at the top left corner of the screen and glides to the wall on the right after the green flag is clicked. It then broadcasts message one, giving the command to show the beach ball starting at where the plane just hid and glide to the floor.