(Improved (This square code is better because the square draws in the sprite's current direction))
(Added rotation)
Line 3: Line 3:
 
A square is very easy to draw. Use this custom [[block]]:
 
A square is very easy to draw. Use this custom [[block]]:
 
<scratchblocks>
 
<scratchblocks>
define square (size)
+
define square (size) (rotation)
 +
point in direction ((90) + (rotation))
 
repeat (4)
 
repeat (4)
 
move (size) steps
 
move (size) steps
Line 10: Line 11:
 
</scratchblocks>
 
</scratchblocks>
 
Your [[sprite]] will now draw a square when you run the block.
 
Your [[sprite]] will now draw a square when you run the block.
 +
 
==Rectangle==
 
==Rectangle==
 
A rectangle is only slightly harder to draw. Use this block:
 
A rectangle is only slightly harder to draw. Use this block:

Revision as of 21:42, 20 January 2016

This tutorial will help you draw shapes using the pen using Custom Blocks.

Square

A square is very easy to draw. Use this custom block:

define square (size) (rotation)
point in direction ((90) + (rotation))
repeat (4)
move (size) steps
turn cw (90) degrees
end

Your sprite will now draw a square when you run the block.

Rectangle

A rectangle is only slightly harder to draw. Use this block:

define rectangle height (height) width (width)
repeat (2)
move (width) steps
turn cw (90) degrees
move (height) steps
turn cw (90) degrees
end

Your sprite will now draw a rectangle when you run the block.

Circle

A circle is is slightly harder to draw than a rectangle. Use this block:

define circle (size)
repeat (round ((360)/(size)))
move (size) steps
turn cw (size) degrees
end

Your sprite will now draw a circle when you run the block.