Examples / p5.js Examples / / drawTown


example p5.js javascript creating-functions

This sketch builds off of the drawHouse example:

This sketch defines a drawTown() function that calls the drawBlock() function four times, and the drawBlock() function calls the drawHouse() function four times.


Remix Ideas

  • Add some variety: give every house a random color.
  • Make some of the houses skyscrapers, or schools, or gardens.
  • Try different patterns: maybe your block only has 3 houses, or maybe your town has 6 blocks.

Comments and Questions

Happy Coding is a community of folks just like you learning about coding.
Do you have a comment or question? Post it here!