ST EK List:
5.5.1 Employ appropriate mathematical and logical concepts in programming. [P1]
5.5.1D Mathematical expressions using arithmetic operators are part of most programming languages.

Angles and Turning

On this page, you will learn about sprite turning angles, which are needed for drawing polygons. For starters, you'll draw various asterisks, like these:
three-spikes five-spikes eight spikes

  1. Click here to load this file for the first set of experiments. Then save it to your Snap! account.
    Perform the four experiments described in the file.
  2. Then, experiment with the last script (shown right):
    repeat (2): {move (100) steps, wait (.5) secs, move (-100) steps, wait (.5) secs, turn (180) degrees, wait (.5) secs}
    1. Experiment with a quarter turn (90 degrees):
      1. Change the turn block input by clicking on the 180 and typing 90.
      2. Adjust the number of repetitions (the number you give to repeat) until you get the sprite to finish facing the same way it started.
        Angle Experiment with 4 turns.
    2. Experiment with a tenth of a turn (36 degrees).
      • What input must you give to repeat to get the sprite to finish facing the same way it started?
    3. Try different input values for the move -100 steps block (like -50, -10, or -90), and do some of the turning experiments (above) again. Does this change the values needed for the repeat block?
    4. Try completely removing the second move block (right-click or control-click and then choose "delete"). Try some of the turning experiments again.
  3. Talk with Your Partner Describe what you've learned about turning angles.
A 360° turn is a full turn. Half of that (180°) is a half turn. A fourth of 360° 360-divided-by-4-with-result-90 is a quarter turn. You don't have to do the division yourself. Snap! can compute it for you. You can use turn-360-divided-by-7-degrees or turn-360-divided-by-3-degrees to get a seventh of a turn or a third of a turn.
Pair Programming Swap
  1. Click here to load this file for the second set of experiments. Then save it to your Snap! account.
    Now, run script (A) in the file and experiment:
    1. Change the inputs in script A to draw an asterisk with:
      1. 5 branches
      2. 8 branches
      3. 3 branches
    2. Make a copy of the three-branch script you built (right-click or control-click the script, and choose "duplicate").
      1. Then, remove the move -100 steps block.
      2. What does this new script do?
    3. Make another copy of the three-branch script you built, and then:
      1. Change it to a four-branch script.
      2. Remove the move -100 steps block again.
      3. What does this new script do?
  1. Script B in the same file shows how you can make a 60-branch script behave like the second hand of a clock. Try it out.
    • Talk with Your PartnerBe sure you are able to explain how this script does what it does.
    • Why is the change in pen color and size useful here?
      clear;repeat(60){set pen color to (black); set pensize to (1); move (100) steps; wait (1) secs; set pen color to (white); set pensize to (3); move (-100) steps; turn clockwise(360/60) degrees}