The Pen Extension (Part 1)
-
Prerequisite
Introduction
In the CreatiCode playground, you can draw on the stage directly, using the Pen extension. You first need to add that extension as shown below:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/6708ed6a-82e1-4cd3-8dd1-1fbafabfa33c.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">
How we draw with a pen
When we try to draw a line on paper, we take 3 steps:
- Put the pen down, so it touches the paper
- Move the pen while keeping the pen down
- Raise the pen up when we are done with the line
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/1d6dce58-18f1-4c68-b7a7-b4b3f4965204.gif" width="400" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">
Pen Down and Pen Up Blocks
To draw on the stage using our sprite, you need to pretend it is a pen. Therefore, you need to use these 2 blocks to put down the pen and hold it up.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2b4580e1-7cd6-47f0-ae4a-4d836e9bc544.png" width="350" style="">
For example, to draw a line, we can put down the pen, move the sprite down a few steps, and then raise the pen up:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d2e90f61-f300-4617-819f-ec60d2444271.gif" width="677" style="border-radius: 5px; border: 1px solid #29622d;">
Note that the pen draws at the center point of the sprite, so the sprite may cover part of the drawing. You can fix that by hiding the sprite. In fact, even if you keep the sprite hidden all the time, it can still work as a pen.
Erase All Drawings
To erase all the drawings on the stage, you can use the “erase all” block:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c112a3a9-48d8-4d0d-944e-e4fde4f3c94a.gif" width="477" style="border-radius: 5px; border: 1px solid #29622d;">
Pen Size
You can make the pen much thicker by changing its size. The tip of the pen is a circle, and the pen size is the diameter of this circle.
First, you can set the pen size directly using the “set pen size” block:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/20bb86fb-194d-4d3c-8b66-9ae86da53a77.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
On the other hand, you can change the pen size relative to its current size, using the “change pen size” block. For example, we can increase the pen size by 10 each time we draw:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/60183083-61ec-420b-a583-fe9e7927aaa3.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
Pen Color
There are 3 ways to change the color of the pen.
- First, you can use the “set pen color to” block, which provides a color picker. Note that transparency works as well. In addition, if you do not move the sprite, the “pen down” block would still draw a big dot centered at the sprite.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5ff08f37-c3f9-4ba3-bc18-011d1e7c9bb9.gif" width="800" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">
- Secondly, you can use the “set pen <color/brightness/saturation/transparency> to” block, which allows you to set the value for these 4 properties directly.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b5b57fbf-a02d-45dd-b436-48f0a7383281.gif" width="600" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">
- Lastly, you can use the “change pen <color/brightness/saturation/transparency> by” block, which allows you to change the value for these 4 properties relative to its current value.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c336038e-ccb8-4f73-a303-cb549064643d.gif" width="600" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">
Stamping
Besides drawing with a pen, you can also use the sprite’s costume as a rubber stamp. When you run the “stamp” block, the sprite will draw itself on the stage.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/fd5a7173-d613-47da-9748-7d7e583c09b9.gif" width="600" style="border-radius: 5px; border: 1px solid #29622d;">
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login