This tutorial will teach how to draw shapes with the pen.
Square
Use this custom block to draw a square where the top-left corner will be the sprite's current position and the top side will be pointed sprite's current direction:
define square (size::custom) pen down repeat (4) move (size::custom) steps turn cw (90) degrees end
To have a square that is not rotated, still using the sprite's current position as the top left corner, use the following script instead:
define square (size::custom) pen down change x by (size::custom) change y by (join [-] (size::custom)) change x by (join [-] (size::custom)) change y by (size::custom)
The sprite will now draw a square when the block is run.
Rectangle
The following script will draw a rectangle, with the current sprite's position as the top left corner and rotated in the current sprite's direction:
define rectangle height (height) width (width) pen down repeat (2) move (width) steps turn cw (90) degrees move (height) steps turn cw (90) degrees end
Circle
This script will draw a circle:
define circle (size::custom) pen down repeat (round ((360)/(size::custom))) move (size::custom) steps turn cw (size::custom) degrees end
Any Regular Polygon
A more advanced, but more versatile method draws any regular polygon:
define polygon sides (sides) radius (radius) set (interior angle) to ((180)-((((sides)-(2))*(180))/(sides)) change y by (radius) point in direction (((180)-(interior angle))/(2)) pen down repeat (sides) turn cw (interior angle) degrees move ((2)*((radius)*([sin v] of ((180)/(sides))))) steps end
The "sides" input controls how many sides the polygon has, and the "radius" controls the distance from the center of the polygon to any vertex (corner) of the polygon.