To make use of the pen block in Scratch, click on on the highlighted picture.[拡張機能を追加]Click on the button.
Click on so as to add the pen extension.
A pen part will seem on the backside of the block menu.
Choose the Pen Down block from the Pen part and add it to the start of this system as follows:
Click on on the flag and you will note the output under indicating that the road has been drawn.
In case you can see traces behind the cat sprite, your pen is working and now you can draw some actually cool patterns.
To take away the cat sprite, add the next code:
You possibly can disguise a Appears to be like block by including it to the highest of your program.
Click on on the flag and you will note the output under exhibiting that the road was drawn with out the cat sprite.
Right here you may change the colour of your pen in one other block within the “Pens” part, however this block is somewhat totally different than the others we have seen to date. The pen colour set for blocking appears to be like like this:
If you’re clicking on the inexperienced flag to check your code, you’ll discover that the drawings you make together with your pen don’t disappear.
To work round this, add a transparent Pen part block to the start of your code.
Drawing patterns utilizing pen graphics
Repeat dragging from the Scratch management part to the block. This kind of loop executes one thing repeatedly till a True/False situation is met.
The next code can be added.
The pen continues to maneuver 50 steps, rotates 15 levels, and shows the next output.
The pen will keep the above sample with out stopping.
Repeat the “contact edge” situation till it loops. The pen continues drawing till it touches the sting of the display screen.
output:
Drawing a circle utilizing pen graphics
In case you change the code to maneuver 5 steps, it should create a circle.
What’s taking place right here is that these 15 levels of rotation find yourself being 360 levels, so the pen rotates fully.
Drawing a sq. utilizing pen graphics
Setting the pen dimension to 10 will change the thickness of the road drawn.
Add a 100-step translation and a 90-degree block rotation to a repeating loop that runs 4 instances, as proven within the code under.
Draw a star utilizing pen graphics
Add 100 steps of translation and 135 levels of block rotation to a repeating loop that runs 8 instances, as proven within the code under.
I hope this helps, thanks.
Additionally learn: Debugging for Youngsters, Frequent Coding Terminology for Youngsters, Occasions in Scratch Programming

