Students: do this first!
  1. Open a web browser and go to www.cca.ac
  2. Login with your codeCampus username and password
  3. Choose 3.1.1 - Number Line Sequence for the lesson and starter project
Overview

This project will show us how to use multiplication (multiples of 10) to move the cat. Each time we press the left or right arrow key, the cat will move left or right by 10 steps.

Step 1: Set where the cat starts

  1. Click on the Events tab.
  2. Then, drag out a “When Green Flag Clicked” block.

Step 2: Set where the cat starts

  1. Click on the Motion tab.
  2. Drag out a “go to x:0 y:10” block.
  3. Attach it to the "when green flag clicked" block.

Step 3: Set where the cat starts

  1. Make sure the numbers in this block are x:0 y:10.

Step 4: Make the cat smaller

  1. Click on the Looks tab.
  2. Bring out the “set size to 100%” block.
  3. Attach it to your other code.

Step 5: Make the cat smaller

  1. Change the number in this block to 10.
  2. This will shrink the cat to 10% (1/10) of its original size.

Recap

Now, when the green flag is clicked, our cat will move to the center of the screen. It will also shrink to 10% of its original size.

Step 6: Code the Right Arrow Key

  1. Click on the Events tab.
  2. Drag out the “when space key pressed” block.

Step 7: Code the Right Arrow Key

  1. Click the small black arrow.
  2. From the menu, select "right arrow".

Step 8: Code the Right Arrow Key

  1. Click on the Motion tab.
  2. Find the "move 10 steps" block.
  3. Attach it to the "when right arrow key pressed" block.

Recap

In the last three steps, we told our computer program that whenever the right arrow key on our keyboard is pressed, the cat sprite should move 10 steps to the right.

Test your work

Click the green flag. Then try tapping the right arrow key on your keyboard. Is your cat moving to the right? If not, go back a step and make sure all of your code is correct.

Step 9: Code the Left Arrow Key

  1. Click on the Events tab.
  2. Drag out the "when space key pressed" block.

Step 10: Code the Left Arrow Key

  1. Click the black arrow (dropdown arrow).
  2. From the menu, select "left arrow".

Step 11: Code the Left Arrow Key

  1. Click on the Motion tab.
  2. Find the "move 10 steps" block.
  3. Attach it to the "when left arrow key pressed" block.
  4. Change the number in this block to -10.

Recap

We have now given our program the instructions to move left using the left arrow key! How is this code similar to the right arrow key code? How is it different?

Discussion

  1. What does the "when green flag clicked" block do?
  2. What does the "go to x:0 y:0" block do?
  3. What does the "move 10 steps" block do?
  4. How many taps would it take to move 80 steps? 150? 210?
  5. Can we use an equation to answer the question above?

Good job! Time to submit your work.

  1. Click "remix", then click "share"
  2. Copy the Scratch project link
  3. Go back to your student dashboard
  4. Make sure you have selected the correct lesson name
  5. Paste the Scratch project link in the last box
  6. Click "Submit to teacher"