My Scratch Stuff

Scratch Lab #2

This is our second scratch lab. This lab was similar to the last one in that there was one partner problem and five individual problems. Again, we were only required to finish three, but I had time to do all five.

Pair Programming

In this pair programming assignment, we worked together with a different partner to create an animation with a person dancing to some music. Once we figured out how to use the pen and sound tools in scratch, it was pretty simple to create the program.

Pair Programming assignment #2

Problem #1: Name Animation

In this problem, we were tasked with creating a simple hand-drawn animation that included our name. I made an animation where words pop us sequentially and when it is all done, the program resets.

Problem #1: Name Animation

Problem #2: Polygons Revisited

In scratch lab 1, we created a program called "Draw a shape" where we used the pen tool to create a square, hexagon, and triangle. Using our new knowledge of the loop and repeat blocks in scratch, I condensed the program to almost half the size it originally was.

Polygons Revisited

Problem #3: Embedded Loop

This wasn't as much a task where we make a program as much as it was an experiment for us to expeirence ourselves, in order to gain more knowledge about coding. I used sprites to visually represent which loop structures moved a sprite 100 steps.

Embedded Loop

Problem #4: Repeat Until

In this problem, we used the "repeat until" block in scratch to create an animation where a sprite animates until a certain condition is met, and then it triggers a second sprite to start animating. For increased difficulty, the sprites have to only show up duting their animation and hide when it is done, in addition to having the stage change and having some music play. At first I had difficulty making the sprites show up and hide at the correct times because of the sprite sizes, but with some perserverence I was able to make it work.

Repeat Until

Problem #5: Loop and Conditional

This was another assignment where we experimented and observed different code blocks with the "if" block, the "repeat" block, and the "forever" block to see which worked best. Again, I used a visual representation to demonstrate which works best.

Loop and Conditional

Questions for Scratch Lab #2

Question #1: Loops

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

In scratch, there are five loops. They are "repeat _ times" "forever" "if _ then" "if _ then else" and "repeat until". "Repeat _ times" runs the following code for the specified amount of time and then it moves on to the subsequent code after the loop. "Forever" is pretty self explanitory. It runs the code inside forever, making it usefor for infinitely looping animations or keeping a program open indefinitely. "If _ then" checks to see if the specified condition is met, and if it is, it runs the code under "then". "If _ then else" is a variation of "if _ then" where if the conditon is not met, it runs the code under else until the condition is met. "Repeat until" repeats the code under until the specified conditon is met.

Question #2: No end in sight

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?

It is best to use the "repeat until" loop because it infinitely repeats until a conditon is met, meaning it can repeat however many times you want it to.

Question #3: Forever Loops

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

It does not work, because there is a forever loop inside the forever loop. The forever loop tries to complete the following code before looping again, but the forever loop goes on forever, so the code before the second loop is never repeated again.

Question #4: Sprite Communication

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

In scratch, there are several condtions that cause the code to start. There is "when "green flag" clicked" "when _ key pressed" "when loudness/timer/video motion > _" and "when I recieve _" When any of these conditons are met, it triggers the following code.

Question #5: Conditionals

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

Yes, because one is checking to see if space has been pressed, and if it is, it says "Spacebar has been pressed" and otherwise, switch costumes until it does. The other block of code checks to see if space is not pressed, and if it is not pressed, it switches costumes until space is pressed, which is when it says "Spacebar has been pressed". The two blocks of code are identical, one is just the opposite of the other.