CSE 111 - Fall 2010 - Banner
  • CSE 111 - Fall 2010
CSE 111 - Fall 2010 - Navigation

Lab Assignment #4
Last modified: October 31 2010 03:57:27 PM

CSE 111 - Fall 2010 - Lab Assignment #4

This week, the class and the TA will work through this assignment as a group to allow everyone to ask questions and get introduced to the Scratch programming environment.

Lab Attendance #2

There will be a lab attendance grade assigned for this assignment. Note that there is a separate line item in the syllabus for lab attendance. This attendance is the second of those three lab attendance grades. In order to receive full credit for the lab attendance, you need to attend at least one lab session during the weeks of October 11th or October 25th.

 

Resources

For this or future labs, you can always (and probably will need to) refer to the getting started guide.

Open Scratch

Click the Scratch program to open it on your computer.

Delete default Sprite

Click on the sprite on the lower right pane to select it. Right click and select delete to remove it from the stage.

Change the background

Click on the Stage in the same lower right panel you just deleted the sprite from. In the center pane, you will now see a tab named "Backgrounds". Click on it and select to edit the current background (white when you start up). In the dialog that pops up, select "Import" and select a picture for your background from any of the available images in the folders.

Add a sprite

From the "New Sprite" selection buttons, click on the one that is for "Choose new sprite from a file". You can figure out which button this is by hovering over it with your mouse and waiting for the "tip" to appear. Select a sprite from any of the available sprite images that you like.

Get the sprite to do something

Make sure that your sprite is selected in the lower right hand box and that the "Scripts" tab is selected in the center panel. Click on "motion" on the left upper panel, and drag the "move 10 steps" block into the center panel. Click on the move block in the center panel (once) to see the sprite move. Click on the "10" and change it to a larger number (30, 40, 50, etc.) by typing the number in and hitting "Enter". Now click on the move block again, and you will notice the sprite move a greater distance.

Removing an action

Drag the move block back to the left to remove it from your script. Or, right-click on the block and select "delete".

Try another action

Put the block "turn 15 degrees" into the script panel and click on it to see what happens. Change the value of the turn so that it is more noticeable to you.

Controlling scripts

Click on the word "control" on the upper left pane. Select the "when green flag clicked" block and drag it into the script panel. Connect it to your "turn degrees" block. Now, if you click on the green flag above the sprite on the stage, the sprite will turn. Add a "move 10 steps" block before the turn. Change the value of the steps if you'd like and now watch the sprite move and turn every time the green flag is clicked.

Edges and Forever

Click on "motion" again to get the movement blocks. Choose "if on edge, bounce" and place it in your script before the move block. Click the green flag to see if your sprite bounces when it reaches an edge. If it isn't getting near an edge, use the mouse to move your sprite (click and drag) to and edge and then click the green flag. Lastly, add a "forever" block around your code for this sprite. This block is in the "control" set of blocks. Now, when you click the green flag, your sprite will move and turn and bounce off the edges until you stop the program.

Add another sprite

Select another sprite to add to your stage. Click the green flag. Notice that your first sprite still does what you programmed it to do, but the second sprite doesn't do anything. Each sprite is programmed independently. You can remove you second sprite from the stage by deleting it.

Sprites for your name

If your name or nickname, has 5 or fewer letters, create a sprite for each letter of your name. If you have more than 5 letters in your name or nickname, use your initials or some other set of letters. You need to have at least three and don't want many more than 5. Note that there is a file folder for letters when you create a sprite.

Make each letter sprite perform a different action forever when the green flag is clicked upon. Try out your program many times to make sure it does what you want at this point.

**** Extra credit - make it so that each letter returns to its proper "position" every time the green flag is clicked, so that every time the program is started, the letters all start out looking correctly positioned and rotated correctly.

Create a dialog between your original sprite and the letters

You will need to remove much of the program from your original sprite to do this. This sprite should now start almost off the edge of the stage. You can move the sprite with the mouse to find out where these coordinates are. When the green flag is pressed, the sprite should come up to the letters (explore the blocks "glide" or "go to" for more interesting effects) and say "Hi! My name is XXXX". Pick a name for your Sprite to fill in the XXXX's. Remember that speaking is under the "Looks" set of blocks. Each of the letters should respond with "I am the letter ?" (fill in the ? appropriately). You will need to work out the timing of the speech and waits to make this work appropriately. Remember that the "wait" block is under the "Control" set of blocks.

Make the sprite react to events

Your non-letter sprite should perform an action when clicked upon with the mouse. The action is up to you, but it must use one or more of the following blocks from the "Looks" set.

  • Switch to costume ??
  • Change ?? effect by 25 - pick any of the choices in the dropdown
  • Change size by ??
  • Set size to ??%

After a few seconds, the graphic should return to normal.

Submit your work

When you have finished your Lab 4 assignment, select to save it by selecting "Save As" from the File menu. Save the project as YourNameLab4 where you put your name in for "YourName" in the filename. Submit it to the digital drop box in UBLearns. In the digital dropbox, you can submit multiple times. We will only grade the last submission you make, so make sure that the last submission is the one you want graded.

NOTE: The assignment is not technically due until Sunday, November 28th at 11:55pm. However, you are welcome and encouraged to submit the assignment early. NO late assignments will be graded.

Want to work on Scratch at Home?

Go to http://www.scratch.mit.edu and download it to your own computer.

 

Lab 4 Grading Information

There are at least three letter sprites on the screen. The letters can appear after the green flag is clicked, or are there when the program is loaded. (2 pts each - 6 points total)

Letter 1 performs and action in a forever block that is different from Letter 2 & Letter 3 (7 points)

Letter 2 performs and action in a forever block that is different from Letter 1 & Letter 3 (7 points)

Letter 3 performs and action in a forever block that is different from Letter 1 & Letter 2 (7 points)

When the flag is clicked:

  • another sprite (not the Scratch cat), is at the edge of the screen, that is some of the sprite should be on the screen, and some should be off. It doesn't matter which edge. (11 points)
  • Sprite1 (non-letter sprite) goes to the letters (10 points)
  • Sprite 1 says "Hi! My name is ..." (9 points)
  • Each letter then responds with "I am the letter ???" (12 points - 4 points per each of the three letters)
  • The above speech is coordinated in time so that all "talk" bubbles are readable (11 points)

Sprite 1 (non-letter sprite) performs an action when clicked upon with the mouse (10 points). This action is one of the following:

  • Switch to costume ??
  • Change ?? effect by 25 - pick any of the choices in the dropdown
  • Change size by ??
  • Set size to ??%

Sprite 1 returns to normal after a few seconds of showing the effect. (10 points)

 

Extra credit (15 points): When the green flag is clicked, the letters return to their original positions. That is, if they were rotating or moving when the program is running and then the program is stopped, clicking the green flag again will cause them to go back to their original positions and orientations.

 

CSE 111 - Fall 2010 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@buffalo.edu | 130 Bell Hall | (716)645-3184