Lesson 1 of 0
In Progress

Draw Different Shapes In A Single Script

Activity : Draw Different Shapes In A Single Script

Chapter-8

Activity

Activity :Draw Different Shapes In A Single Script

In this Activity we made Individual Scripts for drawing Individual shapes. What if we could make just one that can draw any shape?

Using operators we can! Let’s do it:

  1. Import the Pen sprite and set the backdrop.
Import Pen Sprite
  1. Then, add a repeat block and drag and drop the Sides variable block inside the space of the repeat block. Placing the Sides variable block in the space indicates that the repeat block will make the script inside it repeat as many times as the value of Sides.
  2. Next, drag and drop the turn clockwise () degrees and move() steps block from the Motion palette
  3. Next drag and drop the change pen colour block from Pen palette.
Pen Blocks

Below is the script for making Square:

Square Script

Below is the script for making Rectangle:

Rectangle Script

Below is the script for making Octagon:

Octagon Script

Below is the script for making Circle:

Circle Script
  1. Complete the script by adding a when flag clicked block.
  2. Below is the complete script:
Complete Script
Output 1
Output 2
Output 3
Output 4