Time for action – plotting x,y coordinates to draw a square
To complete this exercise, just create a new script in the existing project. That way, we can make use of our custom home block. Let's perform the following steps to do so:
- Start the script with the custom home block, and add a pen down block.
- Next, we need to add four go to x: () y: () blocks. The coordinates for each block are (100, 0), (100, -100), (0,-100), and (0,0) respectively.
- Finish the stack with a pen up block. The following screenshot shows this quick script. As you run this stack of blocks, you'll confirm that you do, in fact, get a square.
What just happened?
I picked an easy example. We're drawing the square by plotting absolute points, meaning we need to know exactly where to position the sprite in terms of its x and y positions in order to get the shape we want. Drawing a pentagon would have been much more difficult. But let's get back to the square.
In previous exercises, we rotated our...