You are on page 1of 4

1501100: Introduction to IT (English)

Spring 2023-24
Lab 2: Visual Programming – Drawing & Motion
Objectives:
1. Move the sprite to different positions using Motion blocks
2. Draw shapes/patterns using the Pen (extension)

STAGE: The normal measurements of the stage can be seen by changing the backdrop to Xy-grid. It has
a width 480(x) and length of 360(y).

PEN (Extensions): To allow the sprite to draw on the stage, add the Pen Extension (new set of blocks):
Part A
Activity A-1: Video Link

Create a Project with the Basketball sprite on the Xy-grid. When the green flag is clicked, it will move
around the 4 corners of the rectangle based on their x and y values.
Use the glide block with 1 second duration. Corners:

(1) Corner 1: x = 0 & y = 0


(2) Corner 2: x = 200 & y = 0
(3) Corner 3: x = 200 & y = 100
(4) Corner 4: x = 0 & y = 100

And then return to the first corner.


Step 0: Change the Backdrop to Xy-grid. Select the Basketball sprite.

Add the starting event: when green flag clicked

Step 1: Add the to get to the first corner of the rectangle (starting point).
Step 2: Similarly, add glide blocks for the rest of the rectangle corners.
Step 3: Lastly, glide back to the first corner.
Activity A-2: Video Link
Draw a house with a triangle roof and square bottom.

A square has 4 sides of equal length with angles of 90 degrees each.


An equilateral triangle has 3 sides of equal length with turns of 120 degrees each.

Write a script using the Pen to draw a triangle with length 150 and a square with length 150.

Use the Key sprite (set size to 70%) to draw the shapes when it is clicked, starting at (x= - 55, y= 0).

Step 0: Select the Key sprite. Add the event. Set size of sprite from Looks:
Add the go to block to move to position (x= -55, y= 0)

Make sure to start drawing in the right direction, point key (sprite) to right using

Step 1: Erase the stage to start drawing using from the Pen block.

Add the block to start drawing. (Optional: change the pen color & size)

Step 2: First, draw the triangle. To draw the first side, use the and change number to 150
(length of a triangle side). The key will draw a line in the direction it is pointing.
Step 3: Before drawing the second side upwards, add the block to turn anti-clockwise
120 degrees. Then. draw the second side of the triangle using the move block with 150 steps.

Step 4: Repeat Step 3 to complete the triangle by drawing the third side.
Tip: Add the move & turn blocks to the Backpack area to reuse them OR simply copy/paste the blocks.

Step 5: Now, we draw the square. Start by pointing in the right direction.
Draw the first side of the square by moving 150 steps (same side as the triangle base).
Then, turn clockwise 90 degrees to draw in the downwards direction for the second side.
Similarly, use move and turn blocks to draw the remaining sides of the square.

Step 6: Lastly, lift the Pen up using the to stop drawing on the stage.

Note: Add the block between each side to visualize the shape being drawn.

*Note: You can try and do the house with only 3 sides of the square (skip the base of the triangle).

You might also like