Row of Houses

In this project, you'll use abstractions inside of abstractions to build a row of houses.
a drawing of a row of houses

  1. "U1-Row-of-Houses"Create a new project called U1-Row-of-Houses
  2. Create a draw square block that takes a size as input. Be sure to test it with different inputs.
    You learned how to create a block with an input on Lab 3 Page 3: Blocks with Inputs.
    draw square, size: () a drawing of a square
  3. Using draw square as an example of where to start, create and test a draw triangle block that takes a size as input and draws an equilateral triangle.
    You learned about turning angles on Lab 3 Page 2: Angles and Turning.
    draw triangle, size: () a drawing of a triangle
  4. Now, use draw square and draw triangle together to create a draw house blocks that takes a size as input and draws a house shape: a square with a triangular shaped roof sitting on top.
    You might have to do some debugging to get the two shapes to connect properly.
    draw house, size: () a drawing of a house, that is a square with a triangle above it
Using a block inside another block is a form of abstraction.
  1. Finally, use your draw house block together with repeat until to create a draw row of houses block that draws a row of attached houses with each new one to the right of the previous. Your program should keep drawing houses until the sprite moves too close to the right edge of the screen. For that, you will need repeat until.
    draw row of houses, size: () a drawing of a row of houses
    repeat until (((x position) + (size)) > 240)
  2. Talk with Your PartnerThe x positions on the Snap! stage go from -240 to 240. How does the repeat until code keep the sprite from drawing too close to the edge of the screen? Now Is a Good Time to Save
  1. Use your draw square block to create a draw flower with square petals block that will draw a flower with square petals with any specified number of petals of the specified size.
    draw flower with (6) square petals of size (50) a drawing of a flower with 6 square petals
  2. Talk with Another PairAfter you've worked on this for a bit, take a moment to look at what others have done. If you see something you like, think how you could use that idea in your program.
  3. Now, draw a field of flowers and give each flower a different size, number of petals, and position.
    You will need to use pen up.
    a drawing of a field of flowers each with a random number of square petals