Robot-Specific Blocks#
Introduction#
The Rover Rescue Playground features blocks exclusive to the VR Rover, including custom Drivetrain, Actions, and Sensing category blocks.
The VR Rover has access to the standard VR Events, Control, Operators, Variables, My Blocks, and Comments blocks.
Below is a list of all available Playground-specific Blocks:
Drivetrain - Move and monitor the VR Rover.
Actions
drive - Drives the VR Rover continuously forward or in reverse.
drive for - Drives the VR Rover for a set distance.
turn - Turns the VR Rover continuously left or right.
turn for - Turns the VR Rover a specific number of degrees.
turn to heading - Turns the VR Rover to face a specific heading.
go to object - Turns and drives the VR Rover to the selected object.
stop driving - Stops all rover movement.
Settings
set drive velocity - Sets the speed for drive blocks.
set turn velocity - Sets the speed for turn blocks.
set drive heading - Manually sets the rover’s heading value.
set drive timeout - Limits how long drivetrain blocks wait to reach their target.
Values
drive is done? - Returns whether the drivetrain is no longer moving.
drive is moving? - Returns whether the drivetrain is currently moving.
drive heading - Returns the drivetrain’s current heading in degrees.
Actions - Interact with the rover’s resources, enemies, and built-in AI systems.
Actions
minerals action - Picks up, drops, or uses minerals.
absorb enemy radiation - Absorbs radiation from an enemy.
standby - Puts the VR Rover into standby mode until a battery threshold is reached.
Values
rover sees - Returns whether the VR Rover sees an object in its vision range.
rover detects - Returns whether the VR Rover detects minerals or enemies in its detect radius.
minerals in storage - Returns how many minerals the VR Rover is carrying.
storage capacity - Returns the VR Rover’s current carrying capacity.
rover direction - Returns the direction to an object in degrees.
rover distance - Returns the distance to an object in millimeters or inches.
rover location - Returns the X or Y coordinate of an object in millimeters or inches.
under attack? - Returns whether the VR Rover is currently under attack.
enemy level - Returns the level of the closest detected enemy.
enemy radiation - Returns the radiation of the closest detected enemy.
battery level - Returns the VR Rover’s current battery level in %.
level - Returns the VR Rover’s current level.
XP - Returns the VR Rover’s current experience points.
when under attack - Runs attached blocks when the VR Rover is attacked.
when level up - Runs attached blocks when the VR Rover levels up.
Sensing - Detect nearby objects with the rover’s Distance Sensor.
Distance found an object? - Returns whether the Distance Sensor detects an object.
object distance - Returns the distance to the nearest detected object.
The examples on this page use the default Playground start position.
Drivetrain#
Actions#
drive#
The drive block moves the drivetrain forward or in reverse using the current drive velocity. This block runs continuously until another Drivetrain block interrupts it or the project stops.
驱动 [向前 v]
Parameters |
Description |
|---|---|
direction |
The direction the robot drives:
|
Example
当开始
[Drive forward, then stop.]
驱动 [向前 v]
等待 (2) 秒
驱动停止
drive for#
The drive for block moves the drivetrain forward or in reverse for a specified distance using the current drive velocity.
驱动 [向前 v] (200) [毫米 v] ▶
Parameters |
Description |
|---|---|
direction |
The direction the robot drives:
|
distance |
The distance the robot drives, as an integer or decimal. |
unit |
The unit of measurement:
|
expanding arrow |
By default, this is a waiting block, so the drivetrain will finish moving before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
Example
当开始
[Drive forward for 500 mm.]
驱动 [向前 v] (500) [毫米 v] ▶
turn#
The turn block turns the drivetrain continuously left or right using the current turn velocity. The drivetrain will keep turning until another Drivetrain block runs or the project stops.
[右 v] 转
Parameters |
Description |
|---|---|
direction |
The direction the robot turns:
|
Example
当开始
[Turn right, then stop.]
[右 v] 转
等待 (2) 秒
驱动停止
turn for#
The turn for block turns the drivetrain left or right for a specific number of degrees using the current turn velocity.
[右 v] 转 (90) 度 ▶
Parameters |
Description |
|---|---|
direction |
The direction the robot turns:
|
angle |
The number of degrees the robot turns, as an integer or decimal. |
expanding arrow |
By default, this is a waiting block, so the drivetrain will finish turning before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
Example
当开始
[Turn left, then turn right.]
[左 v] 转 (90) 度 ▶
[右 v] 转 (180) 度 ▶
turn to heading#
The turn to heading block turns the drivetrain to face a specific heading using the current turn velocity.
归位至 (90) 度 ▶
Parameters |
Description |
|---|---|
heading |
The absolute heading the drivetrain will turn to, from -360 to 360 degrees. |
expanding arrow |
By default, this is a waiting block, so the drivetrain will finish turning before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
Example
当开始
[Turn to face east.]
归位至 (90) 度 ▶
go to object#
The go to object block turns and drives the VR Rover to the selected object.
go to [minerals v] ▶
Parameters |
Description |
|---|---|
object |
Which object the VR Rover will go to:
|
expanding arrow |
By default, this is a waiting block, so the rover will finish moving before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
If the VR Rover detects multiple minerals or multiple enemies, it will move to the closer option.
If minerals or an enemy are not detected in the rover’s visual range when the block runs, the robot will not drive. The base can always be targeted.
Example
当开始
[Drive to the closest mineral.]
go to [minerals v] ▶
stop driving#
The stop driving block immediately stops all movement of the drivetrain.
驱动停止
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Drive forward, then stop.]
驱动 [向前 v]
wait (4) seconds
驱动停止
Settings#
set drive velocity#
The set drive velocity block sets the default movement speed as a percentage for all subsequent drive blocks in the project. By default, the drive velocity is set to 50%.
设定驱动速度为 (50) [% v]
Parameters |
Description |
|---|---|
velocity |
Sets the default movement velocity from 0% to 100%. |
Example
当开始
[Move faster.]
设定驱动速度为 (100) [% v]
驱动 [向前 v] (100) [毫米 v] ▶
set turn velocity#
The set turn velocity block sets the default velocity as a percentage for all subsequent turn blocks in the project. By default, the turn velocity is set to 50%.
设定转向速度为 (50) [% v]
Parameters |
Description |
|---|---|
velocity |
Sets the default turn velocity from 0% to 100%. |
Example
当开始
[Turn faster.]
set turn velocity to (100) [% v]
[右 v] 转 (90) 度 ▶
set drive heading#
The set drive heading block sets the gyro’s current heading to a specified value.
设定底盘归位至 (0) 度
Parameters |
Description |
|---|---|
heading |
The heading value to assign, in degrees. |
Example
当开始
[Set the heading, then turn to 0 degrees.]
设定底盘归位至 (90) 度
归位至 (0) 度 ▶
set drive timeout#
The set drive timeout block sets a time limit for how long a Drivetrain block will wait to reach its target. If the robot cannot complete the movement within the set time, it will stop automatically and continue with the next block.
Note: The drivetrain’s time limit is used to prevent Drivetrain blocks that do not reach their target position from stopping the execution of other blocks in the stack.
设定驱动超时为 (1) 秒
Parameters |
Description |
|---|---|
time |
The maximum number of seconds a Drivetrain block will run before stopping and moving to the next block. |
Example
当开始
[Drive for at most 1 second.]
设定驱动超时为 (1) 秒
驱动 [向前 v] (25) [英寸 v] ▶
Values#
drive is done?#
The drive is done? block returns a Boolean indicating whether the drivetrain is not moving.
True - The drivetrain is not moving.
False - The drivetrain is moving.
Note: This block only detects movement from blocks that can expand to show the and don’t wait option.
<驱动已结束?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Start turning when the drive is complete.]
驱动 [向前 v] (200) [毫米 v] ◀ 并且不等待
等到 <驱动已结束?>
[右 v] 转 (360) 度 ▶
drive is moving?#
The drive is moving? block returns a Boolean indicating whether the drivetrain is moving.
True - The drivetrain is moving.
False - The drivetrain is not moving.
Note: This block only detects movement from blocks that can expand to show the and don’t wait option.
<驱动进行中?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Print while the rover is moving.]
驱动 [向前 v] (200) [毫米 v] ◀ 并且不等待
当 <驱动进行中?>
打印 [Still Moving...] ▶
等待 (0.1) 秒
清除所有行
结束
打印 [Done!] ▶
drive heading#
The drive heading block returns the drivetrain’s heading angle as a decimal number, in the range 0 to 359.99 degrees.
(底盘归位角度值)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Display the heading after turning.]
[右 v] 转 (90) 度 ▶
打印 (底盘归位角度值) ▶
设定光标至下一行
Actions#
Actions#
minerals action#
The minerals action block interacts with minerals in the Rover Rescue Playground.
minerals [pick up v]
Parameters |
Description |
|---|---|
action |
What to do with minerals:
|
Picking up minerals stores them in the VR Rover until they are dropped or used.
Using minerals replenishes some of the VR Rover’s energy. Minerals can only be used if they are on the ground.
The VR Rover gains Experience Points (XP) by using minerals or dropping them at the base.
Example
当开始
[Drive to the closest mineral and pick it up.]
go to [minerals v] ▶
minerals [pick up v]
absorb enemy radiation#
The absorb enemy radiation block absorbs radiation from an enemy in the Rover Rescue Playground.
absorb radiation
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Drive to the closest enemy and absorb radiation.]
go to [enemy v] ▶
absorb radiation
standby#
The standby block puts the VR Rover into standby mode until the specified battery threshold is reached.
standby until [50] % battery
Parameters |
Description |
|---|---|
percent |
The battery threshold that causes the VR Rover to exit standby mode, from 0 to 100. |
While in standby, the VR Rover uses its battery more slowly, but the Number of Days Survived counter increases at a higher rate.
When the battery reaches the selected threshold, the VR Rover exits standby mode and returns to normal battery usage and day progression.
If the selected threshold is equal to or above the current battery level, the VR Rover will not enter standby mode.
Example
当开始
[Wait in standby until battery reaches 35%.]
standby until [35] % battery
go to [minerals v] ▶
Values#
rover sees#
The rover sees block returns a Boolean indicating whether the VR Rover sees the selected object using its built-in AI technology.
True - The selected object is within 1000 millimeters of the VR Rover and within its field of view.
False - The selected object is farther than 1000 millimeters away and/or outside the field of view.
<sees [minerals v]?>
Parameters |
Description |
|---|---|
object |
Which object to check for:
|
The VR Rover’s field of view is 40 degrees, shown in the mini-map as the gray translucent cone extending from the front of the rover.
Example
当开始
永久循环
if <sees [minerals v]?> then
go to [minerals v] ▶
结束
结束
rover detects#
The rover detects block returns a Boolean indicating whether the VR Rover detects minerals or enemies using its built-in AI technology.
True - The selected object is within the rover’s detect radius.
False - The selected object is not within the rover’s detect radius.
<detects [minerals v]?>
Parameters |
Description |
|---|---|
object |
Which object to detect:
|
The VR Rover’s detect radius is 800 millimeters, shown in the mini-map as the yellow circle around the rover.
Example
当开始
永久循环
if <detects [minerals v]?> then
go to [minerals v] ▶
结束
结束
minerals in storage#
The minerals in storage block returns the current amount of minerals the VR Rover has in its storage.
(minerals in storage)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
print (minerals in storage) ▶
设定光标至下一行
storage capacity#
The storage capacity block returns the carrying capacity of the VR Rover’s storage.
(storage capacity)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
print (storage capacity) ▶
设定光标至下一行
rover direction#
The rover direction block returns the direction from the VR Rover to the selected object in degrees.
([minerals v] direction in degrees)
Parameters |
Description |
|---|---|
object |
Which object’s direction to report:
|
For minerals and enemies, this block only reports values when the selected object is within 1000 millimeters and inside the rover’s 40 degree field of view.
If base is selected, the direction is reported even when the base is not in the field of view. For the base, this block reports a value from -180 to 180 degrees.
Example
当开始
print ([minerals v] direction in degrees) ▶
设定光标至下一行
rover distance#
The rover distance block returns the distance from the VR Rover to the selected object.
([minerals v] distance in [mm v] :: custom-actions)
Parameters |
Description |
|---|---|
object |
Which object’s distance to report:
|
unit |
The unit used to report the distance:
|
For minerals and enemies, this block only reports values when the selected object is within 1000 millimeters and inside the rover’s 40 degree field of view.
If base is selected, the distance is reported even when the base is not in the field of view.
Example
当开始
print ([minerals v] distance in [mm v] :: custom-actions) ▶
设定光标至下一行
rover location#
The rover location block returns the X or Y coordinate of the selected object using the rover’s built-in AI technology.
([minerals v] location [X v] in [mm v])
Parameters |
Description |
|---|---|
object |
Which object’s location to report:
|
axis |
Which coordinate to return:
|
unit |
The unit used to report the coordinate:
|
For minerals and enemies, this block only reports values when the selected object is within 1000 millimeters and inside the rover’s 40 degree field of view.
If base is selected, the location is reported even when the base is not in the field of view.
Example
当开始
print ([base v] location [X v] in [mm v]) ▶
设定光标至下一行
print ([base v] location [Y v] in [mm v]) ▶
设定光标至下一行
under attack?#
The under attack? block returns a Boolean indicating whether the VR Rover is currently under attack from an enemy.
True - The VR Rover is under attack.
False - The VR Rover is not under attack.
<under attack?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
永久循环
if <under attack?> then
drive [reverse v] for [500] [mm v] ▶
结束
结束
enemy level#
The enemy level block returns the level of the closest enemy detected by the VR Rover.
(enemy level)
Parameters |
Description |
|---|---|
This block has no parameters. |
When no enemies are detected in the VR Rover’s detect radius, this block returns 0.
Example
当开始
永久循环
if <(enemy level) [math_equal v] [1]> then
go to [enemy v] ▶
否则
drive [reverse v] for [500] [mm v] ▶
结束
结束
enemy radiation#
The enemy radiation block returns the radiation of the closest enemy detected by the VR Rover.
(enemy radiation)
Parameters |
Description |
|---|---|
This block has no parameters. |
When no enemies are detected in the VR Rover’s detect radius, this block returns 0.
Example
当开始
print (enemy radiation) ▶
设定光标至下一行
battery level#
The battery level block returns the current battery level of the VR Rover as a percent.
(battery level in % :: custom-actions)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
print (battery level in % :: custom-actions) ▶
设定光标至下一行
level#
The level block returns the current level of the VR Rover.
(level)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
print (level) ▶
设定光标至下一行
XP#
The XP block returns the current number of Experience Points the VR Rover has.
(XP)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
print (XP) ▶
设定光标至下一行
when under attack#
The when under attack block runs its attached stack each time the VR Rover is attacked by an enemy.
when under attack
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when under attack
absorb radiation
when level up#
The when level up block runs its attached stack each time the VR Rover moves from one level to the next.
when level up
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when level up
print [The VR Rover has leveled up!] ▶
设定光标至下一行
Sensing#
Distance#
Distance found an object?#
The Distance found an object? block returns a Boolean indicating whether the Distance Sensor has detected an object within 2000 mm.
True - The Distance Sensor has detected an object.
False - The Distance Sensor has not detected an object.
<[distance v] found an object?>
Parameters |
Description |
|---|---|
distance sensor |
Which Distance Sensor to use. In this Playground, the available sensor is |
Example
当开始
[Turn until the Distance Sensor detects an object.]
[右 v] 转
wait until <[distance v] found an object?>
驱动停止
object distance#
The object distance block returns the distance of the nearest object from the Distance Sensor.
([distance v] in [mm v])
Parameters |
Description |
|---|---|
distance sensor |
Which Distance Sensor to use. In this Playground, the available sensor is |
unit |
The unit of measurement:
|
Example
当开始
[Wait until the Distance Sensor detects an object, then print the distance.]
[右 v] 转
wait until <[distance v] found an object?>
驱动停止
print ([distance v] in [mm v]) ▶