Lab1: Starting with Scratch

Read time: 12 minutes (3085 words)

To get started building simple programs, we will use a simple tool even kids use to make computers do what they want. Of course, we are not “playing” here, we are learning a few basic concepts. There is nothing wrong with a bit of fun, though!

The tool we will be using is a version of Scratch.

Warning

The latest versions of Scratch are designed to run on a remote server. The older version we will use will run on your own computer. Be sure to get this set up correctly.

I want you to get Scratch running this week, and start playing with it. The details on installing it are in these notes:

Once you get things installed, read over this getting started guide:

Your First Project

Once you get going, try to build a script that makes that silly cat spin around in a circle. You will need a few basic components to do this:

  • From the Control Menu:

    • “When Flag Clicked” - to start the program running (when you click on it, Natch!)
    • “forever” - a loop that runs until you stop the program
  • From the Motion Menu:

    • “Move N steps” - to move forward a bit. Play with N to make it move further
    • “turn N degrees” - to make the cat turn a bit. Play with the number here as well.

    Make the circle it moves in as big as you can and keep it on the screen!

Note

You can reposition the cat by clicking on it and dragging it to a new location before you start the program running. To stop the program, click on the red stop button at the top of the right screen.

With just these simple controls you should make that cat run in circles. For this experiment, spinning forever is all we need to do. If you think about what is going on. The cat is moving forward a small distance, turning just a bit, moving forward the same amount, then turning again. Done enough times, the cat will run in a circle and hopefully get very dizzy!

Note

This should take only a few seconds of work to complete, AFTER you read through the getting started guide!

Running your code

Once you have your example constructed, just click on the green flag and the action should begin. Obviously, this is not much of a program, but it will prove that you can get it running, and I will know you are ready for more interesting problems.

Note

Our goal in using Scratch is not just to play with the program but to practice putting together those basic structures we discussed in this week’s lectures. You need to understand these tools, and start learning when to put them into your programs to do something you hope will solve a problem.

Extra Credit

As an extra credit problem. See if you can get the cat to do the same spinning around, but in a square path. You should not need any additional controls, but you might want to slow things down by using one of those “wait N seconds” controls somewhere in the forever loop. You can put in any value you like. Try 0.1, or 2 and see what happens.

What to Turn In

For Scratch projects, you will save your program in a file named “something.sb”. That is the file I want you to upload to Blackboard by next Sunday. For this week’s project. Name it Lab1_DizzyCat The program will add the .sb extension when you save it.

Hope you have a bit of fun with this project!