Introduction to Computer Programming
Scratch Lab #2
Loops and Repetition
This lab consists of two parts. First, a pair programming assignment that will familiarize you with the scratch IDE. After completing the pair assignment you should begin work individually.
Table of Contents
Question #4-Sprite Communication
You must complete 3 of the following 5 problems. If you adequately complete those three and still have time, you are expected to continue working on the other problems. You are assessed on both the correctness of your code as well as full use of the lab time given during class.
You need to be able to answer all of the following questions. Your answers will be posted on your website.
Create your own sprite that contains your name. You need to animate it using multiple costumes.
Now that you have the ability repeat commands with loops, rewrite your solution for polygon creation. At a minimum, your sprite should be able to create a regular hexagon. For a challenge, try to create a circle!
Try the following loop structures. Which will result in the sprite moving 100 steps? Think about WHY this is happening. You should embed your answers as comments (right click and select “add comment”)
Create an animation containing two sprites. The first sprite should animate until a given event (i.e. touching the edge, touching a sprite, a key is pressed…). After the event occurs, the first sprite should broadcast a message that triggers the animation for the second sprite. For added difficulty have the sprites only show up during their animation, have the stage change and have some music play
Using any sprite you’d like, run the following code. Which seems to work the best? Why?
What are the types of loops contained in Scratch? What are the differences?
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?
Does the following loop structure work? Does it make sense? Why or why not?
How can sprites “know” when to begin an action? Is there more than one way?
Are the following code snippets equivalent? Why or why not?