Name: Colin Yang

Period: 7

Assignment: Lab #2

Lab Overview Problem #1

This lab asked us to animate our own name by having it do a certain action when the flag is clicked.

My Solution

My solution involved multiple hand drawn costumes of the sprite, with a step by step procedure to eventually make the O into a stick figure (The costumes were made to look like a stop motion animation). When the green flag is clicked, the sprite would first go to the costume with simply my name on it. Then, it would wait one second and switch to the next costume. The procedure would be repeated until it reaches its final form of the stick figure.

My Project Link

Lab Overview Problem #4

Problem #4 asks us to have two different sprites, with one continuing with the animation until it reached the edge. The other sprite would then react to the first sprite touching the edge by starting on its own animation.

My Solution

For the first sprite, he would start off on the left side of the screen when the flag is pressed. From there, it would slowly glide to the other side of the screen, switching costumes every two seconds. Then, I added an if command, so that when it touches the edge of the screen, it would broadcast the message pimp out. The other sprite would then receive the message and start its forever loop of the animation (by switching costumes).

My Project Link

Lab Overview Problem #5

This lab gave us three different commands and asked which one worked out the best. The sprite, once the green flag was clicked, would react to the mouse, and state "There's a mouse in my house!" when the mouse would touch it.

My Solution

Of the three, the script that didn't include any loops worked the best. The one with only the if statement said the sentence "There's a mouse in my house!" while the other two had no reaction when the mouse touched the sprite. Because it was an If statement, the sprite would do whatever is told everytime the corresponding action applied to it, without the need for a loop in it.

My Project Link

Questions

1.What are the types of loops contained in Scratch? What are the differences?

Scratch has 3 different types of loops, including a repeat loop, a forever loop, and a repeat until loop. The repeat loop repeats the command only a certain number of time, while the forever loop will repeat the command over and over until the red stop button is pressed. The repeat until button works similarly like the repeat loop, except instead of a number, the command repeats itself until a certain action takes place. For example, a sprite may turn 90 degrees every second until the space bar is pressed.

2.If you are given a situation where you want an action to repeat, but you don’t know how long it should repeat for, which loop is the best structure to use? Why?

Using the normal repeat loop would work the best because the user can determine how many times the action will repeat. By choosing the number, the user can either decrease or increase the number of repetition and adjust how long the action should last.

3.Does the following loop structure work? Does it make sense? Why or why not?

Yes the given loop structure works. After saying Forever Loop!, the sprite reads another forever loop that tells it to say Forever and Ever!!, causing it to be stuck in the second loop permanently and ignore the first loop.

4.How can sprites “know” when to begin an action? Is there more than one way?

In order for a spite to know when to start, it requires an event (the buttons that start with when) button to help it cue it. Buttons such as the when space key pressed, or when I receive message 1 will help the sprite know when to begin an action.

5.Are the following code snippets equivalent? Why or why not?

The following codes are equivalent because the first one tells it to say something when a button is pressed and if not switch costumes, while the second one tells it to switch costumes when a button is pressed and if not say something.