Exploring snap Drawing and Motion

Work with a Partner

You have already programmed an app in the snap programming language.

A program is a set of scripts that tell a computer what to do. A script is an ordered (top to bottom) sequence of instructions. In snap, you program by dragging blocks (individual instructions) and snapping them together into scripts.

Now, you will experiment with some more blocks that snap provides to learn what they do. Soon, you will create your own blocks of code—blocks that snap doesn't have.

    Motion palette categories: Motion, Looks, Sound, Pen, Control, Sensing, Operators, and Variables
    The blocks' colors match their palettes: blue for Motion, green for Pen, etc.
  1. Build this script.
    pen down, repeat 4 (move 50 steps, turn CW 90 degrees)
    Clicking anywhere on a script runs it.

    When you have built it, click on it to see what it does.
  2. Talk with Your Partner Analyze why that script does what it does.
  3. Talk with Another Pair Compare your work with another pair. If your script behaves differently from theirs, check both.
  4. Pair Programming Swap Switch who is sitting at the keyboard.
  5. Experiment! What happens if you...
    1. Change the number in the move 50 steps block and click the script to run it with that new number?
    2. You can click clear (or any other block) in its palette or in the scripting area (but not in a script) to run it at any time.
      Click the clear block in the green Pen palette?
    3. Change the number in the turn right 90 degrees block and run the script again... and again... and again?
    4. Change the number in the repeat 4 block?
    5. Use set pen size to 1 to set the pen size to something like 4 or 10 or 50?
    6. To change the pen size you must click the set pen size block after you've entered the number you want.
 
  1. Experiment more! Invent some design of your own. Below are other blocks that you may find useful. Find them by color, and click on them to see what they do.

    go to x 0 y 0 point in direction 90 set pen color dark red

  2. Pair Programming Swap
  3. Draw a circle. Adjust the repeat [move, turn] script that you made above, but use tiny turns (1 or 2 degrees) repeated many times. Adjust the size so that your drawing fits on the stage.
  4. Share Your Work with another pair.
  5. If you see some feature or code that you like, build something like it in your own program.
    Tough Stuff
  6. Challenge: Create a script that draws a blue square of size 100 and then draws a red circle that fits perfectly inside it.

    red circle in blue square