Drawing#
Introduction#
The VR Robot uses a pen to draw on a playground as it moves. The robot’s pen can change width, color, and fill enclosed area.
Below is a list of all available blocks:
move pen – Raise or lower the robot’s pen.
set pen to width – Set the width of the robot’s pen.
set pen to color – Set the color of the robot’s pen from a list.
set pen color – Set the color of the robot’s pen with red, green, and blue values.
fill area – Fill a playground or an enclosed area with a specified color.
move pen#
The move pen block raises or lowers the robot’s pen, allowing it to start or stop drawing.
move pen [down v]
Parameters |
Description |
|---|---|
state |
The state of the robot’s pen:
|
Example
when started :: hat events
[Draw a square.]
move pen [down v]
repeat (4)
drive [forward v] for [150] [mm v] ▶
turn [right v] for [90] degrees ▶
set pen to width#
The set pen to width block sets how thick the drawn lines from the pen appear.

set pen to width [thin v]
Parameters |
Description |
|---|---|
width |
The width of the robot’s pen:
|
Example
when started :: hat events
[Draw an extra wide square.]
set pen to width [extra wide v]
move pen [down v]
repeat (4)
drive [forward v] for [150] [mm v] ▶
turn [right v] for [90] degrees ▶
set pen to color#
The set pen to color block sets the color of the pen from a preset list.
set pen to color [black v]
Parameters |
Description |
|---|---|
color |
The color of the robot’s pen:
|
Example
when started :: hat events
[Draw a blue square.]
set pen to color [blue v]
move pen [down v]
repeat (4)
drive [forward v] for [150] [mm v] ▶
turn [right v] for [90] degrees ▶
set pen color#
The set pen color block sets the color of the pen by manually providing red, green, blue, and opacity values. Adjust the different values by using the sliders that appear when clicking the color in the set pen color block.
set pen color ( ::#000000)
Parameters |
Description |
|---|---|
red |
The red value of the color from 0 to 255. |
green |
The green value of the color from 0 to 255. |
blue |
The blue value of the color from 0 to 255. |
opacity |
How transparent the color is as a percentage from 0 to 100. |
Example
when started :: hat events
[Draw a pink square.]
set pen color ( ::#D900D9)
move pen [down v]
repeat (4)
drive [forward v] for [150] [mm v] ▶
turn [right v] for [90] degrees ▶
fill area#
The fill area block fills a playground or enclosed area with a specified color by manually providing red, green, blue, and opacity values. Adjust the different values by using the sliders that appear when clicking the color in the fill area block.
fill area with color ( ::#000000)
Parameters |
Description |
|---|---|
red |
The red value of the color from 0 to 255. |
green |
The green value of the color from 0 to 255. |
blue |
The blue value of the color from 0 to 255. |
opacity |
How transparent the color is as a percentage from 0 to 100. |
Example
when started :: hat events
[Fill the playground with pink.]
move pen [down v]
fill area with color ( ::#D900D9)