Line Art Toy

Unit 1 Optional Project

In this project, you are going to simulate the famous children’s toy Etch A Sketch®.

Sprite Art

  1. Here are some things to do at the start of your program when green flag clicked:

    • Clear any previous drawings
    • Place the drawing sprite at the center of the screen
    • Point it in the up direction
    • Set the drawing pen to a color and size of your choice
    • Put pen down to get ready for drawing
  2. Write code that will clear the drawings when space key pressed by the user.
  3. The user will use the arrow keys to draw. You’ll need a script for each key, starting with a when key pressed block:
    when space key pressed
    For each of the four arrow keys, make the sprite point in the direction of the arrow and then move forward 10 steps.

Here is how Snap! assigns angles for directions:

  • 0° is up
  • 90° is right
  • 180° is down
  • -90° (or also 270°) is left
  1. Change your code to draw only if the sprite is within the screen dimensions: -240 to 240 in the x direction (horizontal) and -180 to 180 in the y direction (vertical).
  2. Give your user some coloring options. For example, when the “1” key is pressed, the pen color is reset to black; when the “2” key is pressed, the pen color is set to red; etc. (Suggestion: Load the crayon library) Also consider using some keys to put the pen up or pen down.
  3. Give your user the option to draw diagonal lines. For example, write code to move the sprite at 45°, 135°, 225°, 315°, using the “w,” “s,” “a,” and “q” keys.