// The p5.js push() function allows you to create a new state and pop() function restores the state to the previous conditions. This allows you to have completely different settings applied to individual objects without worrying those settings to affect the shapes that come after as long as you do everything in between a push() and a pop() call. Here is how it works: function setup() { createCanvas(900, 900); } function draw() { background(240); for (var x = 5; x < 600; x = x + 50) { for (var y = 5; y < 600; y = y + 50) { push(); translate(x, y); drawHouse(); pop(); } } } function drawHouse() { triangle(15, 0, 0, 15, 30, 15); rect(0, 15, 30, 25); rect(12, 30, 10, 10); }