How To Draw A Rectangle In Scratch
Drawing Basic Geometrical Shapes and Complex patterns using Scratch Pen Tool
This tutorial will take you through a series of coding activities using Scratch pen tool where you will learn the concepts of coding; sequence and looping while brushing up your knowledge on polygons and related geometrical concepts.
First, let's learn a bit about Scratch. Scratch is a block-base d visual programming language developed by the Lifelong Kindergarten group at MIT's Media Lab in early 2000 by a team headed by Dr. Mitch Reznick. Since then, Scratch has gained an unprecedented level of popularity and has become the 'lingua franca' language for anyone learning to code. Early last year, Scratch launched its version 3 with a whole set of exciting new features.
One of the most exciting additions in Scratch 3 is its new extension platform. Among them, the pen tool is quite unique. As the name suggests, an extension is a plug-in that extends the functionality of Scratch that allows you to do exciting things than normal Scratch cant do.
With the Pen extension, coding to draw a shape is deceptively simple with some basic knowledge of geometry. Furthermore, amazingly complex patterns can be constructed with just a few colorful blocks of computer code. (Those who hate Math, Do not panic yet!, this is pretty simple and straightforward). With the pen tool, the possibilities are immense and incredibly exciting. With your imagination coupled with your creativity, the patterns you can come up with is simply enormous.
Ready for the adventure? Then, let's get started!
- First, you need to launch Scratch. You can use either use the online editor (https://scratch.mit.edu/projects/editor/) or you can download and install it from https://scratch.mit.edu/download
2. Remove the "cat" sprite by clicking the "trash" icon
3. Click 'Add Extension'
4. Click on Pen
Once added, the following Pen code blocks will be listed.
5. You need a sprite to do the drawing for you. In fact, you need a sprite (with a top view) that will help you to see the direction of movement when drawing when turning to different directions. Following are some of such sprites you can use:
6. Click on the "Choose a sprite" icon to add one of the above sprites. For this tutorial, we will use the Beetle sprite.
Drawing a simple straight line
Now, we will see how to draw a simple straight line. To do that, we need to initiate the program and then do some initialization .
- To initiate the program, click on the Events from the block palette and drag and drop the following code block to the script area.
Note that there are other blocks you can use to initiate the program such as:
2. Add the following code blocks (The purpose of each is labeled)
3. Now, you need to add one more block as part of the initialization. That's the following code block to ensure every time when you start drawing, the sprite is turned towards the right in 90 degrees.
Now, your code blocks should look like the below:
4. Now, add the block to move the pen for 150 steps.
Congratulations! You have done your first program using the pen tool. The program and the resulted output on stage are shown below:
Now with these simple concepts, let's try drawing the following:
Drawing steps
Drawing square
Drawing rectangle
Drawing triangle
Drawing pentagon
Drawing Hexagon
Some complex shapes using loops within loops and some degrees turn
Drawing a snowflake
Though this looks complicated, drawing this snowflake is really easy. First, you need to figure out what it is made up of. In the case of the above snowflake, it's the letter 'Y' like component. Let's try to draw that:
- Put together the following blocks to draw the 'Y'
2. Now repeat the above code block inside a loop (Repeat 6 times) with 60 degrees turn after printing each bar.
Now let's try out something little tricky. Try the following coding challenge.
Coding Challenge
Hope you enjoyed this coding tutorial. Happy Coding and Good luck!
[This tutorial is based on the SLASSCOM TechKids Online Coding Workshops — Drawing Shapes using Scratch Pen Tool conducted by two passionate TechKids code club volunteers Ishara Illangasinghe and Shiraz Azad. If you have any suggestions or comments, please reach us at techkids@slasscom.lk]
How To Draw A Rectangle In Scratch
Source: https://medium.com/@shiraz.azad0707/drawing-basic-geometrical-shapes-and-complex-patterns-using-scratch-pen-tool-5db65111a885
Posted by: singletonbectinced.blogspot.com
0 Response to "How To Draw A Rectangle In Scratch"
Post a Comment