Double Click on the Scratch Icon on the Desktop to Open Scratch

Double Click on the Scratch Icon on the Desktop to Open Scratch

CS001 Lab-1

SCRATCH

  1. Double click on the scratch icon on the desktop to open Scratch

Whenwe open Scratch, we notice that the development environment roughlydivides into three distinct sections, as seen in the followingscreenshot. Moving from left to right, we have the following sectionsin sequential order:

  • Blocks palette
  • Script editor
  • Stage

Exercise -1

  1. In the blocks palette, click on the Looks button.
  2. Drag the switch to costume block onto the scripts area.
  3. Now, in the blocks palette, click on the Control button.
  4. Drag the when flag clicked block to the scripts area and snap it on top of the switch to costume block, as illustrated in the following screenshot.

How to snap two blocks together?

Asyou drag a block onto another block, a white line displays to indicate that the block you are dragging can be added to the script. When yousee the white line, release your mouse to snap the block in place.

  1. In the scripts area, click on the Costumes tab to display the sprite’s costumes.

style

  1. Click on costume2 to change the sprite on the stage. Now, click back on costume1 to change how the sprite displays on the stage.
  2. Directly beneath the stage is a sprites list. The current list displays Sprite1 and Stage.
  3. Click on the sprite named Stage and notice that the scripts area changes. Click back on Sprite1 in the sprites list and again note the change to the scripts area.
  4. Click on the flag above the stage to set our first Scratch program in motion. Watch closely, or you might miss it.
    style

What just happened?

Congratulations! You created your first Scratch project.

It’s a good practice to get in the habit of saving your work. Save your work early, and save it often:

  1. To save your new project, click File | Save As.
  2. A Save Project dialog box opens and asks you for a location and a New Filename.
  3. Location of your files will be your x: drive
  4. Save it as Project1

style

(Please show your work to the demonstrator before you proceed further)

Exercise-2

1. Click on the "Costumes" Tab
style
2. Click "Import"
3. Select a Folder (Animals, People, Things)
style
4. Choose a Sprite! (Double Click)

Step 2: Making Your Sprite Move in 4 directions (Right, Left, Up, Down)

Sprites can not do anything by themselves. A Sprite's action comes from the scripts in the script window. These scripts are the instructions for exactly what the sprite will do. You drag these instructions from the Tile pane into the "Scripts" pane. These tiles then fit together like a puzzle to create the insructions.

5. Click on the "Scripts" Tab
6. You want your Sprite to move to the right. Click the "Control" Button

7. Left Click and hold "When 'space' pressed" command and drag to the Scripts window.

8. Click on the word "space" and select "right arrow." (We will make Sprite move right)

9. Click on the "Motion" button and drag "point in direction 90" over to the Scripts window.

10. Connect the "point in direction" tile to the "When 'right arrow' pressed" command.

11. Click the "Move 10 steps" tile and drag over to the Scripts window.

12. Connect "Move 10 steps" to the "point in direction" tile.

13. Press the right arrow on the computer and watch your sprite move to the right.
14. Making your sprite go left: Drag the "When 'space' pressed" tile to the scripts window.

15. Drag "point in direction 90" over to the Scripts window. Connect to the "When 'space' pressed." tile.

16. Change the 'space' to 'left arrow.' Change the '90' to '-90' to make the sprite face left:

17. Drag the "Move 10 steps" tile to the scripts window and connect to the 'left arrow' script.

18. Now your left arrow will work! Click the "just flip left-right" icon to make your sprite face in the correct directions.

19. Making your sprite move down: Drag and connect the following tiles:
a. "When 'space' pressed
b. "point in direction '90'"
c. "move 10 steps"

20. Set the direction to down:
a. Change 'space' to 'down arrow'
b. Change '90' to '180'

21. Your down arrow should work!
22. Make your sprite move up: Drag and connect the following tiles:
a. "When 'space' pressed
b. "point in direction '90'"
c. "move 10 steps"

23. Set the direction to up:
a. Change 'space' to 'up arrow'
b. Change '90' to '0'

24. Now your Sprite should be able to move in all 4 directions! Test your program by moving your Sprite about the screen.
25. Save your work! Click "Save" and navigate to your x: drive and save it as Project2.

(Please show your work to the demonstrator before you proceed further)

Exercise-3

  1. Open Project1 which was your first exercise and continue with these following steps.
  2. From the blocks palette, select Motion.
  3. Drag the change x by block to the script area for Sprite1 and snap it in place at the end of the script. See the following screenshot for reference:
  1. Double-click on the script and watch your sprite move across the stage.

Double-clicking on the script runs through each block of the script.

  1. The change x by block has an number field with a default value of 10. This number controls how far the sprite moves. Change 10 to 20.
  2. Double-click on the script again.
  3. From the motion palette, drag the change y by block and add it to the end of your script.
  4. Change the value in the change y by block to a negative number, such as -30.
  5. Click the flag.

What just happened?

Sofar the cat has moved incrementally across the screen by a set numberof pixels and has stopped. Now, we’re going to introduce the idea thatthe cat can stay in motion forever.

  1. From the Control palette, drag the forever block onto the stack of blocks. Position it in such a way that it snaps in place between the when flag clicked and switch to costume blocks.
  2. Double-click the stack of blocks and watch the cat disappear from the stage.
  3. From the Motion palette, drag the if on edge, bounce block and snap it to the bottom of the change y by block. Now watch the cat reappear and bounce around the bottom-right corner of the stage.
  4. Single-click on the script to stop the cat.

(Please show your work to the demonstrator before you proceed further)

Exercise-4

Weneed to get the cat out of the corner and moving across the stage insome kind of orderly fashion. We’ll do that by replacing the change x by and change y by blocks:

  1. Click on the scissors icon located on the toolbar above the stage to activate the scissors tool.
  1. Move the scissors over the change x by block until it is outlined in a red square. Click your left mouse button to delete the block.
  1. Similarly, delete the change y by block.
  2. From the Motion palette, drag the move 10 steps block into your script and snap it in place before the if on edge, bounce block.
  3. From the Looks palette, snap the switch to costume block into place after the move 10 steps block. Double-click the script to set it in motion. Select costume1 from the list of costumes.
  4. Add a second switch to costume block before the move 10 steps block. Select costume2 from the list of costumes.

The
drop-down menu on the stack of blocks is sensitive. Click directly on
the black triangle to display the available selections.

  1. If the cat stopped moving, double-click the script again. It should be running upside down!
  2. Let’schange the rotation of the sprite. Information about the current spritedisplays directly above the script area. To the left of the sprite arethree directional buttons: can rotate, only face left-right, and don’t rotate.

Many buttons in Scratch will display a tool tip when you hover your mouse over the button. Try it with the rotation buttons.

  1. Click on the only face left-right rotation button, and now our sprite doesn’t run upside down when it bounces off the side of the stage.

What just happened?

(Please show your work to the demonstrator before you proceed further)

Do it yourself:

Make the cat run backward across the screen.

Hint: Set the rotation of the sprite to don’t rotate.

(Please show your work to the demonstrator to get your marks)

Additional exercise