Time for action – drawing our first square
Let's start a new project and call it shapes
. We'll work with the default cat sprite using the following steps:
- Add the when () key pressed block from Events, and choose the letter d for draw. We'll use this key to draw the shape.
- From the Pen palette, add the pen down block.
- Attach a move () steps block, and set a value of
50
. - After the move (50) steps block, add a turn () degrees block, and change the value to
90
. - Duplicate the move (50) steps and turn (90) degrees blocks three times. Your script should look like the following screenshot:
- Press the d key, and observe that the cat quickly draws a square as shown in the following screenshot. Press the d key repeatedly, and note that the shape doesn't change.
What just happened?
We drew a square even though it happened too quickly to see, and the cat is partially obstructing the line. We'll make our script more concise soon enough, but this simple script introduces us to...