Create a project using default sprite draw a rectangle using the pen blocks and when a space key pressed. In scratch , I just need the code for this question who will answer it correct will be marked as brainleist..
The Scratch Wiki is made by and for Scratchers. Do you want to contribute?
Learn more about joining as an editor!
See discussions in the Community Portal
How to Draw Shapes with the Pen
This tutorial will teach how to draw shapes with the pen.
Square
Use this custom block to draw a square where the top-left corner will be the sprite's current position and the top side will be pointed sprite's current direction:
define
square
size
pen
down
repeat
4
move
size
steps
turn
90
degrees
To have a square that is not rotated, still using the sprite's current position as the top left corner, use the following script instead:
define
square
size
pen
down
change
x
by
size
change
y
by
join
-
size
change
x
by
join
-
size
change
y
by
size
The sprite will now draw a square when the block is run.
Rectangle
The following script will draw a rectangle, with the current sprite's position as the top left corner and rotated in the current sprite's direction:
Answers & Comments
Verified answer
Answer:
Jump to sidebar
Jump to content
Scratch Wiki
Search the Wiki
Navigation
Scratch Wiki Home
Community Portal
Current Events
Recent Changes
Random Page
Help
About
Tools
What links here
Related changes
Special pages
Printable version
Permanent link
Page information
In other languages
Français
Nederlands
For Editors
WW Suggestions
Things To Do
Wiki Sandbox
Your Sandbox
Edit
Page history
Purge cache
Help the wiki!
The Scratch Wiki is made by and for Scratchers. Do you want to contribute?
Learn more about joining as an editor!
See discussions in the Community Portal
How to Draw Shapes with the Pen
This tutorial will teach how to draw shapes with the pen.
Square
Use this custom block to draw a square where the top-left corner will be the sprite's current position and the top side will be pointed sprite's current direction:
define
square
size
pen
down
repeat
4
move
size
steps
turn
90
degrees
To have a square that is not rotated, still using the sprite's current position as the top left corner, use the following script instead:
define
square
size
pen
down
change
x
by
size
change
y
by
join
-
size
change
x
by
join
-
size
change
y
by
size
The sprite will now draw a square when the block is run.
Rectangle
The following script will draw a rectangle, with the current sprite's position as the top left corner and rotated in the current sprite's direction:
define
rectangle
height
height
width
width
pen
down
repeat
2
move
width
steps
turn
90
degrees
move
height
steps
turn
90
degrees
Circle
This script will draw a circle:
define
circle
size
pen
down
repeat
round
360
/
size
move
size
steps
turn
size
degrees