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 "5.1.1 - Equation Drawer" for the lesson and starter project
Overview

In this project, we will solve equations to draw a picture!

Step 1: Set our stage

  1. Click on the Events tab.
  2. Then, drag out a “When Green Flag Clicked” block.
  3. This block tells our program to start reading the code when the green flag above the stage is clicked.

Step 2: Set our stage

  1. Click on the Looks tab.
  2. Then, drag out a “Switch Backdrop to” block.
  3. Change the text to say, "Switch Backdrop to 'xy-grid-20px'"

Step 3: Set our pen

  1. Click on the Motion tab.
  2. Then, drag out a "go to x: '0' y: '0'" block.
  3. Attach it to the "switch backdrop" block.
  4. Change the numbers to say, "go to x: '20' y:'40'"

Step 4: Set our pen

  1. Click on the Pen tab.
  2. Then, drag out a “Clear” block.
  3. Attach it to the "go to x: '20' y:'40'"

Step 5: Set our pen

  1. Click on the Pen tab.
  2. Then, drag out a "pen up" block.
  3. Attach it to the "clear" block.

Step 6: Set our pen

  1. Click on the Pen tab.
  2. Then, drag out a "set pen size to '10'" block.
  3. Attach it to the "pen up" block.

Step 7: Set our pen

  1. Click on the Pen tab.
  2. Then, drag out a "set pen color to " block.
  3. Attach it to the "set pen size" block.
  4. Click on the colored square at the end of the block, and change the color to white.

Step 8: Set our pen

  1. Click on the Pen tab.
  2. Then, drag out a "pen down" block.
  3. Attach it to the "set pen color" block.

Recap

  1. Let's recap:
  2. We set the backdrop to the xy-grid.
  3. We cleared the screen.
  4. We moved the pen into its starting place, color, and size.
  5. We set "pen down" to start drawing!

Step 9: Ask a question

  1. Click on the Sensing tab.
  2. Drag out the "ask 'What's your name?' and wait" block.
  3. Attach it to the "pen down" block.
  4. Change the text to say, "ask 'If y = x + 100 and x = -20, what is y?' and wait"

Discussion

This block asks our user - the person using our app - a question. Our user can type an answer to the question. Now, we need to do something with their answer!

Step 10: Draw the mast

  1. Click on the Motion tab.
  2. Drag out the "go to x: '0' y: '0'" block.
  3. Attach it to the ask block.
  4. Click on the Sensing tab.
  5. Drag out the "answer" block and insert it next the "y" section of our "go to" block.
  6. Change the numbers to say, "go to x: '-20' y: 'answer'"

Test your work

Click on the green flag - what happens? Why?

Step 11: Ask a question

  1. Click on the Sensing tab.
  2. Drag out the "ask 'What's your name?' and wait" block.
  3. Attach it to the "go to x: '-20' y: 'answer'" block.
  4. Change the text to say, "ask 'Now, what if x = 70?'"

Step 12: Draw the sail

  1. Click on the Motion tab.
  2. Drag out the "go to x: '0' y: '0'" block.
  3. Attach it to the ask block.
  4. Click on the Sensing tab.
  5. Drag out the "answer" block and insert it next the "y" section of our go to block.
  6. Change the numbers to say, "go to x: '70' y: 'answer'"

Step 13: Draw the sail

  1. Click on the Looks tab.
  2. Drag out the "say 'hello' for 2 secs" block and attach it to the "go to" block.
  3. Change the text to say, "Let's go back to 0, 0!"
  4. Click on the Motion tab.
  5. Drag out the "go to x: '0' y: '0'" block.
  6. Attach it to the ask block.

Step 14: Change our pen color

  1. Click on the Pen tab.
  2. Drag out a "set pen color to " block.
  3. Attach it to the say block.
  4. Click on the colored square at the end of the block once.
  5. Without clicking, move your mouse over to a color on the screen that you want to copy.
  6. Once you see the color you want, click once to select that color.

Step 15: Ask a question

  1. Click on the Sensing tab.
  2. Drag out the "ask 'What's your name?' and wait" block.
  3. Attach it to the "change pen color" block.
  4. Change the text to say, "ask 'if y = x/100 and x = -100, what is y?'"

Step 16: Move our pen

  1. Click on the Motion tab.
  2. Drag out the "go to x: '0' y: '0'" block.
  3. Attach it to the ask block.
  4. Click on the Sensing tab.
  5. Drag out the "answer" block and insert it next the "y" section of our go to block.
  6. Change the numbers to say, "go to x: '-100' y: 'answer'"

Test your work

Click on the green flag - what happens? Why?

Step 17: Ask a question

  1. Click on the Sensing tab.
  2. Drag out the "ask 'What's your name?' and wait" block.
  3. Attach it to the "go to" block.
  4. Change the text to say, "ask 'if x = y/10 and y = -100, what is x?'"

Step 18: Move our pen

  1. Click on the Motion tab.
  2. Drag out the "go to x: '0' y: '0'" block.
  3. Attach it to the ask block.
  4. Click on the Sensing tab.
  5. Drag out the "answer" block and insert it next the "x" section of our go to block.
  6. Change the numbers to say, "go to x: 'answer' y: '-100'"

Step 19: Ask a question

  1. Click on the Sensing tab.
  2. Drag out the "ask 'What's your name?' and wait" block.
  3. Attach it to the "go to" block.
  4. Change the text to say, "ask 'if x = y/-2 and y = 100, what is x?'"

Step 20: Move our pen

  1. Click on the Motion tab.
  2. Drag out the "go to x: '0' y: '0'" block.
  3. Attach it to the ask block.
  4. Click on the Sensing tab.
  5. Drag out the "answer" block and insert it next the "x" section of our go to block.
  6. Change the numbers to say, "go to x: 'answer' y: '100'"

Step 21: Draw the right side of the ship

  1. Click on the Sensing tab.
  2. Drag out the "ask 'What's your name?' and wait" block.
  3. Attach it to the "go to" block.
  4. Change the text to say, "ask 'if y = x/100 and x=100, what is y?'"

Step 22: Draw the right side of the ship

  1. Click on the Motion tab.
  2. Drag out the "go to x: '0' y: '0'" block.
  3. Attach it to the ask block.
  4. Click on the Sensing tab.
  5. Drag out the "answer" block and insert it next the "x" section of our go to block.
  6. Change the numbers to say, "go to x: '100' y: 'answer'"

Step 23: Finishing up

  1. Click on the Control tab.
  2. Drag out the "wait '1' secs" block.
  3. Change the number to say, "wait '.5' secs"
  4. Click on the Motion tab.
  5. Drag out the "go to x: 0 y: 0" block.

Step 24: Finishing up

  1. Click on the Looks tab.
  2. Drag out the "switch backdrop to ''" block.
  3. Make sure you're switching the backdrop to "city with water2"
  4. Finally, make it say "Great job! A boat!!" for 2 seconds.

Recap

  1. Great job!
  2. We made a game that will draw a line of our picture everytime we answer a question.
  3. If we answer a question incorrectly, the boat won't come out right.
  4. Try it out!

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"