Lab 1.3: Triangles and Squares and Stars, Oh My

In this lab, you will write your first Snap! programs to draw some simple shapes on the stage.

Part 1: Drawing a triangle

  1. Modify your Snap! program so that a triangle is drawn when the number 1 is pressed on the keyboard.

    Angles of a triangle diagram

  2. Modify your script so that the sprite says the word “triangle” while it draws. The sprite should stop saying “triangle” once it has finished drawing.

  3. Modify your script so that pressing the space bar clears the pen marks from the stage.

Part 2: Adding more shapes

  1. Now that you’ve drawn a triangle, add code to draw the shapes in the following table. Each shape should be drawn when the number next to it is pressed on the keyboard. (For example, pressing 3 on the keyboard should draw a diamond.)

    When this key is pressed…

    Draw a …

    1

    Equilateral triangle

    2

    Square

    3

    Diamond

    4

    Pentagon

    5

    Parallelogram (“leaning rectangle”)

    6 (optional)

    5-pointed star

    You may want to draw a diagram like the one above of a triangle to figure out the angles in each shape.

  2. Modify your script so that as each shape is being drawn, the sprite is saying the name of shape. The sprite should stop saying the name of the shape when it is finished drawing.

  3. Modify your script so that each different shape is drawn in a different color and with a different line thickness. So, for example, if the square is drawn in blue with a line thickness of 3, each other shape must be drawn in a color that is not blue and with a line thickness that is not 3.

  4. Modify your script so that the sprite is hidden when it is not drawing. This is will make sure that the sprite is not obstructing the view of your beautiful artwork!

Grading Scheme/Rubric

Lab 1.3 Criteria

Points

1 - Equilateral Triangle

0.25 points

2 - Square

0.25 points

3 - Diamond

0.5 points

4 - Pentagon

0.5 points

5 - Parallelogram

0.5 points

Star (bonus!)

0.5 points

PROJECT TOTAL

2.5 points