(Redirected from Draw Shapes with the Pen)

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
Cookies help us deliver our services. By using our services, you agree to our use of cookies.