(updating cat) |
m (→Square: fixed typo) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This tutorial will help you draw shapes using the [[pen]] using [[Custom Blocks]]. | This tutorial will help you draw shapes using the [[pen]] using [[Custom Blocks]]. | ||
+ | |||
==Square== | ==Square== | ||
− | A square is very easy to draw. Use this custom [[block]] if you want it in the sprite's direction | + | A square is very easy to draw. Use this custom [[block]] if you want it in the sprite's direction: |
<scratchblocks> | <scratchblocks> | ||
− | define square (size) | + | define square (size::custom) |
pen down | pen down | ||
repeat (4) | repeat (4) | ||
− | move (size) steps | + | move (size::custom) steps |
turn cw (90) degrees | turn cw (90) degrees | ||
end | end | ||
</scratchblocks> | </scratchblocks> | ||
+ | |||
If you always want it at 90°, then use this: | If you always want it at 90°, then use this: | ||
<scratchblocks> | <scratchblocks> | ||
− | define square (size) | + | define square (size::custom) |
pen down | pen down | ||
− | change x by (size) | + | change x by (size::custom) |
− | change y by (join [-] (size)) | + | change y by (join [-] (size::custom)) |
− | change x by (join [-] (size)) | + | change x by (join [-] (size::custom)) |
− | change y by (size) | + | change y by (size::custom) |
</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. | ||
Line 33: | Line 36: | ||
</scratchblocks> | </scratchblocks> | ||
Your sprite will now draw a rectangle when you run the block. | Your sprite will now draw a rectangle when you run the block. | ||
+ | |||
==Circle== | ==Circle== | ||
A circle is is slightly harder to draw than a rectangle. Use this block: | A circle is is slightly harder to draw than a rectangle. Use this block: | ||
<scratchblocks> | <scratchblocks> | ||
− | define circle (size) | + | define circle (size::custom) |
− | repeat (round ((360)/(size))) | + | repeat (round ((360)/(size::custom))) |
− | move (size) steps | + | move (size::custom) steps |
− | turn cw (size) degrees | + | turn cw (size::custom) degrees |
end | end | ||
</scratchblocks> | </scratchblocks> |
Latest revision as of 00:17, 18 August 2020
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 if you want it in the sprite's direction:
define square (size::custom) pen down repeat (4) move (size::custom) steps turn cw (90) degrees end
If you always want it at 90°, then use this:
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)
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::custom) repeat (round ((360)/(size::custom))) move (size::custom) steps turn cw (size::custom) degrees end
Your sprite will now draw a circle when you run the block.