We can also use loops to create multiple iterations of drawing. The following exercises demonstrate this.
Excercise 2-6. Clear the screen and drag the Sprite to the bottom left of the stage. Now write a script that changes the color of the pen by 20 and moves 10 steps in X and 10 steps in Y on each iteration of a loop so that the output looks something like the following. Use 20 iterations of the loop and don't forget to put the pen down.
There are multiple possible solutions for this, but the following script will do the trick:
Load the script we saved previously to draw a house shape. Place the Sprite in the top left corner of the Stage and draw multiple houses diagonally across the stage. To do this, you will need to change XPos and YPos by some small amount (let's say 1 step) on each iteration of the loop. Also, change the "set pen color to" block to "change pen color by 1" and set the initial pen color to 0. Make the loop iterate 100 times. Your final output should look something like the following:
Again, there are multiple ways to do this. Here is one: