Python ειδικά για ρομπότ#
Εισαγωγή#
Το ρομπότ VR Rover περιλαμβάνει σύστημα μετάδοσης κίνησης, αισθητήρα απόστασης και λειτουργίες μοναδικές για την παιδική χαρά Rover Rescue.
Όλες οι τυπικές μέθοδοι VR VEXcode είναι διαθέσιμες για χρήση στο Rover Rescue Playground. Παρακάτω είναι μια λίστα με όλες τις διαθέσιμες μεθόδους ειδικά για το Playground:
Σύστημα μετάδοσης κίνησης - Μετακίνηση και παρακολούθηση του VR Rover.
Ενέργειες
drive- Moves the VR Rover forward or reverse forever.drive_for- Moves the VR Rover forward or reverse for a specific distance.turn- Turns the VR Rover left or right forever.turn_for- Turns the VR Rover left or right for a specific number of degrees.turn_to_heading- Turns the VR Rover to face a specific heading from -359 to 359 degrees.drive_to- Drives the VR Rover straight toward the selected object.turn_to- Turns the VR Rover to face the selected object.go_to- Turns and drives the VR Rover to the selected object.stop- Stops the VR Rover’s movement.
Μεταλλαγμένοι
set_heading– Changes the VR Rover’s current heading to a new heading.set_timeout- Sets how much time the VR Rover will try to finish a movement.set_drive_velocity– Tells the VR Rover how fast to drive.set_turn_velocity– Tells the VR Rover how fast to turn.
Αποκτητές
Κονσόλα – Εκτύπωση στην Κονσόλα και παρακολούθηση τιμών.
Αποτύπωμα
brain.print— Displays text, numbers, or variable values in the Console.brain.new_line— Moves the Console cursor to the start of the next row.brain.set_print_color— Sets the color used for text printed in the Console.brain.clear— Clears all rows from the Console.
Ελεγκτής εκπομπών
monitor_variable— Adds one or more predefined variables to the Monitor tab.monitor_sensor— Adds one or more sensor values to the Monitor tab.
Ανίχνευση - Εντοπισμός κοντινών αντικειμένων με τον αισθητήρα απόστασης του ρόβερ.
Απόσταση
found_object- Returns whether the Distance Sensor detects an object.get_distance- Returns the distance to the nearest detected object.
Ενέργειες - Αλληλεπιδράστε με τους πόρους, τους εχθρούς και τα ενσωματωμένα συστήματα τεχνητής νοημοσύνης του ρόβερ.
Ενέργειες
pickup- Picks up minerals.drop- Drops minerals.use- Uses minerals to restore energy.absorb_radiation- Absorbs radiation from an enemy.standby- Puts the VR Rover into standby mode until a battery threshold is reached.
Αποκτητές
angle- Returns the direction to an object in degrees.get_distance- Returns the distance to an object in millimeters or inches.location- Returns the X or Y coordinate of an object in millimeters or inches.battery- Returns the VR Rover’s battery level.minerals_stored- Returns how many minerals the VR Rover is carrying.storage_capacity- Returns the VR Rover’s carrying capacity.level- Returns the VR Rover’s current level.exp- Returns the VR Rover’s current experience points.enemy_level- Returns the level of the closest detected enemy.enemy_radiation- Returns the radiation of the closest detected enemy.detects- Returns whether the VR Rover detects minerals or enemies in its detect radius.sees- Returns whether the VR Rover sees an object in its vision range.under_attack- Returns whether the VR Rover is currently under attack.
Επανακλήσεις
on_under_attack- Runs a callback when the VR Rover is attacked.on_level_up- Runs a callback when the VR Rover levels up.
Τα παραδείγματα σε αυτήν τη σελίδα χρησιμοποιούν την προεπιλεγμένη θέση έναρξης της Παιδικής Χαράς.
Σύστημα μετάδοσης κίνησης#
Το σύστημα μετάδοσης κίνησης ελέγχει τον τρόπο με τον οποίο κινείται και στρίβει το VR Rover. Το σύστημα μετάδοσης κίνησης μπορεί να κινείται προς τα εμπρός ή προς τα πίσω, να στρίβει αριστερά ή δεξιά, να στρίβει προς κατεύθυνση και να κατευθύνεται προς ορυκτά, εχθρούς ή τη βάση.
Ενέργειες#
οδηγώ#
drive moves the VR Rover forward or reverse forever. The VR Rover will continue to move until it is given another action, like turning or stopping.
Usage:
drivetrain.drive(direction)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the VR Rover moves: |
def main():
drivetrain.drive(FORWARD)
wait(2, SECONDS)
drivetrain.stop()
# VR threads — Do not delete
vr_thread(main)
μονάδα_δίσκου#
drive_for moves the VR Rover forward or reverse for a specific distance. The project will wait until the VR Rover is done moving before the next line of code runs.
Usage:
drivetrain.drive_for(direction, distance, units, wait=True)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the VR Rover moves: |
|
The distance the VR Rover drives. This can be an |
|
The distance unit: |
|
Optional. |
def main():
drivetrain.drive_for(FORWARD, 200, MM)
# VR threads — Do not delete
vr_thread(main)
σειρά#
turn turns the VR Rover left or right forever. The VR Rover will continue to turn until it is given another action, like driving or stopping.
Usage:
drivetrain.turn(direction)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the VR Rover turns: |
def main():
drivetrain.turn(RIGHT)
wait(2, SECONDS)
drivetrain.stop()
# VR threads — Do not delete
vr_thread(main)
στροφή_για#
turn_for turns the VR Rover left or right for a specific number of degrees. The turn is relative to the current position of the VR Rover. The project will wait until the VR Rover is done turning before the next line of code runs.
Usage:
drivetrain.turn_for(direction, angle, units, wait=True)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the VR Rover turns: |
|
The number of degrees the VR Rover turns. This can be an |
|
The rotation unit: |
|
Optional. |
def main():
drivetrain.turn_for(RIGHT, 90, DEGREES)
# VR threads — Do not delete
vr_thread(main)
στροφή_προς_την_κατεύθυνση#
A heading is the direction the VR Rover is facing, measured in degrees. turn_to_heading turns the VR Rover to face a specific heading from -359 to 359 degrees. The VR Rover will turn the shortest direction to reach the target heading.
Η αρχική κατεύθυνση του VR Rover είναι 0 μοίρες.
Το έργο θα περιμένει μέχρι να ολοκληρώσει την περιστροφή του VR Rover προτού εκτελεστεί η επόμενη γραμμή κώδικα.
Usage:
drivetrain.turn_to_heading(heading, units, wait=True)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the VR Rover should face, in degrees. This can be an |
|
The heading unit: |
|
Optional. |
def main():
drivetrain.turn_to_heading(90, DEGREES)
# VR threads — Do not delete
vr_thread(main)
drive_to#
drive_to drives the VR Rover straight toward the selected object.
Usage:
drivetrain.drive_to(object, wait=True)
Παράμετροι |
Περιγραφή |
|---|---|
|
Which object the VR Rover will drive to:
|
|
Optional. |
If a mineral or enemy is not detected in the VR Rover’s visual range when drive_to is called, the VR Rover will not drive. The base can always be targeted.
Εάν το VR Rover ανιχνεύσει πολλά ορυκτά ή πολλαπλούς εχθρούς, θα κινηθεί προς την πιο κοντινή επιλογή.
def main():
drivetrain.drive_to(MINERALS)
# VR threads — Do not delete
vr_thread(main)
στροφή_προς#
turn_to turns the VR Rover to face the selected object.
Usage:
drivetrain.turn_to(object, wait=True)
Παράμετροι |
Περιγραφή |
|---|---|
|
Which object the VR Rover will turn toward:
|
|
Optional.
|
If a mineral or enemy is not detected in the VR Rover’s visual range when turn_to is called, the VR Rover will not turn. The base can always be targeted.
Εάν το VR Rover ανιχνεύσει πολλά ορυκτά ή πολλαπλούς εχθρούς, θα στραφεί προς την επιλογή πλησιέστερου πλάνου.
def main():
drivetrain.turn_to(MINERALS)
# VR threads — Do not delete
vr_thread(main)
μετάβαση_σε#
go_to turns and drives the VR Rover to the selected object.
Usage:
drivetrain.go_to(object, wait=True)
Παράμετροι |
Περιγραφή |
|---|---|
|
Which object the VR Rover will turn and drive to:
|
|
Optional. |
If a mineral or enemy is not detected in the VR Rover’s visual range when go_to is called, the VR Rover will not drive. The base can always be targeted.
Εάν το VR Rover ανιχνεύσει πολλά ορυκτά ή πολλαπλούς εχθρούς, θα μετακινηθεί στην επιλογή πλησιέστερου πλάνου.
def main():
drivetrain.go_to(MINERALS)
# VR threads — Do not delete
vr_thread(main)
στάση#
stop stops the VR Rover’s movement.
Usage:
drivetrain.stop()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
drivetrain.drive(FORWARD)
wait(2, SECONDS)
drivetrain.stop()
# VR threads — Do not delete
vr_thread(main)
Μεταλλάκτες#
set_heading#
A heading is the direction the VR Rover is facing, measured in degrees. set_heading changes the VR Rover’s current heading to a new heading value.
Για παράδειγμα, εάν το VR Rover έχει στρίψει προς τα δεξιά, η ρύθμιση της κατεύθυνσης σε 0 μοίρες καθιστά αυτήν τη θέση προς τα δεξιά τις νέες 0 μοίρες. Στη συνέχεια, το VR Rover μπορεί να στρίψει σε άλλες θέσεις με βάση αυτήν τη νέα κατεύθυνση.
Usage:
drivetrain.set_heading(heading, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The heading value, in degrees, to set for the VR Rover. This can be an |
|
The heading unit: |
def main():
drivetrain.set_heading(0, DEGREES)
# VR threads — Do not delete
vr_thread(main)
set_timeout#
set_timeout sets how much time the VR Rover will try to finish a movement. If the VR Rover cannot finish in that time, it will stop trying and move on to the next line of code. This keeps the VR Rover from getting stuck on a movement.
Usage:
drivetrain.set_timeout(value, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The amount of time the VR Rover can try to finish a movement. This can be a positive |
|
The time unit: |
def main():
drivetrain.set_timeout(1, SECONDS)
# VR threads — Do not delete
vr_thread(main)
set_drive_velocity#
set_drive_velocity tells the VR Rover how fast to drive. A higher percentage makes the VR Rover drive faster and a lower percentage makes the VR Rover drive slower.
Κάθε έργο ξεκινά με το VR Rover να κινείται με ταχύτητα 50% από προεπιλογή.
Σημείωση: Μια υψηλότερη ταχύτητα κάνει το VR Rover να κινείται πιο γρήγορα, αλλά μπορεί να είναι λιγότερο ακριβές. Μια χαμηλότερη ταχύτητα κάνει το VR Rover να κινείται πιο αργά, αλλά μπορεί να είναι πιο ακριβές.
Usage:
drivetrain.set_drive_velocity(velocity, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The velocity to drive with from 0% to 100%. This can be an |
|
The velocity unit: |
def main():
drivetrain.set_drive_velocity(50, PERCENT)
# VR threads — Do not delete
vr_thread(main)
ορισμός_ταχύτητας_στροφής#
set_turn_velocity tells the VR Rover how fast to turn. A higher percentage makes the VR Rover turn faster and a lower percentage makes the VR Rover turn slower.
Κάθε έργο ξεκινά με το VR Rover να περιστρέφεται με ταχύτητα 50% από προεπιλογή.
Σημείωση: Μια υψηλότερη ταχύτητα κάνει το VR Rover να περιστρέφεται πιο γρήγορα, αλλά μπορεί να είναι λιγότερο ακριβές. Μια χαμηλότερη ταχύτητα κάνει το VR Rover να περιστρέφεται πιο αργά, αλλά μπορεί να είναι πιο ακριβές.
Usage:
drivetrain.set_turn_velocity(velocity, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The velocity to turn with from 0% to 100%. This can be an |
|
The velocity unit: |
def main():
drivetrain.set_turn_velocity(50, PERCENT)
# VR threads — Do not delete
vr_thread(main)
Αποκτητές#
επικεφαλίδα#
A heading is the direction the VR Rover is facing, measured in degrees. heading returns the VR Rover’s current heading from 0 to 359.99 degrees.
Η αρχική κατεύθυνση του VR Rover είναι 0 μοίρες.
Usage:
drivetrain.heading(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The heading unit: |
def main():
brain.screen.print(drivetrain.heading(DEGREES))
# VR threads — Do not delete
vr_thread(main)
είναι_ολοκληρωμένο#
is_done returns whether the VR Rover is finished moving, as a Boolean value. This can be used to control the timing of other behaviors based on the VR Rover’s movement.
True— The VR Rover is finished moving.False— The VR Rover is still moving.
This method works together with Drivetrain methods that have the wait parameter, such as drive_for, turn_for, turn_to_heading, drive_to, turn_to, and go_to.
Usage:
drivetrain.is_done()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
drivetrain.drive_for(FORWARD, 200, MM, wait=False)
wait(0.1, SECONDS)
if drivetrain.is_done():
brain.screen.print("Drive complete")
# VR threads — Do not delete
vr_thread(main)
is_moving#
is_moving returns whether the VR Rover is moving, as a Boolean value. This can be used to control the timing of other behaviors based on the VR Rover’s movement.
True— The VR Rover is moving.False— The VR Rover is not moving.
Usage:
drivetrain.is_moving()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
drivetrain.drive_for(FORWARD, 200, MM, wait=False)
wait(0.1, SECONDS)
if drivetrain.is_moving():
brain.screen.print("Still moving")
# VR threads — Do not delete
vr_thread(main)
Κονσόλα#
Η Κονσόλα εμφανίζει κείμενο, αριθμούς και τιμές μεταβλητών ενώ εκτελείται ένα έργο. Οι μέθοδοι κονσόλας μπορούν επίσης να μετακινήσουν τον κέρσορα σε μια νέα γραμμή, να ορίσουν το χρώμα του κειμένου που εκτυπώνεται μετά την αλλαγή του χρώματος, να διαγράψουν την Κονσόλα και να προσθέσουν μεταβλητές ή τιμές αισθητήρα στην καρτέλα Παρακολούθηση.
Αποτύπωμα#
εγκέφαλος.εκτύπωση#
brain.print displays text, numbers, or variable values in the Console using the current cursor position.
Use brain.new_line when you want the next printed value to start on a new row.
Usage:
brain.print(value)
Παράμετροι |
Περιγραφή |
|---|---|
|
Το κείμενο, ο αριθμός ή η τιμή μεταβλητής που θα εμφανίζεται στην Κονσόλα. |
def main():
# Display a message in the Console
brain.print("Hello, rover!")
# VR threads — Do not delete
vr_thread(main)

brain.new_line#
brain.new_line moves the cursor to column 1 on the next row in the Console. The next value printed will appear on that row.
Usage:
brain.new_line()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
# Print on two rows
brain.print("Row 1")
brain.new_line()
brain.print("Row 2")
# VR threads — Do not delete
vr_thread(main)

brain.set_print_color#
brain.set_print_color sets the color used for text printed in the Console after this method is used. At the start of a project, the Console text color is set to BLACK.
Usage:
brain.set_print_color(color)
Παράμετροι |
Περιγραφή |
|---|---|
|
The color to use for text printed in the Console:
|
def main():
# Print text in different colors
brain.print("Default text color")
brain.new_line()
brain.set_print_color(RED)
brain.print("Red text color")
# VR threads — Do not delete
vr_thread(main)

εγκέφαλος.καθαρός#
brain.clear clears all rows from the Console and moves the cursor back to Row 1.
Usage:
brain.clear()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
# Display text, then clear it after two seconds
brain.print("This will disappear...")
wait(2, SECONDS)
brain.clear()
# VR threads — Do not delete
vr_thread(main)
Ελεγκτής εκπομπών#
μεταβλητή_παρακολούθησης#
monitor_variable adds one or more predefined variables to the Monitor tab in VEXcode. This lets you watch a variable’s value change while a project is running.
Variables must be global for monitor_variable to monitor them successfully. Provide each variable name as a string.
Usage:
monitor_variable(“variable”)
monitor_variable(“variable1”, “variable2”)
Παράμετροι |
Περιγραφή |
|---|---|
|
Το όνομα μιας προκαθορισμένης καθολικής μεταβλητής προς παρακολούθηση, που δίνεται ως συμβολοσειρά. Για να παρακολουθείτε περισσότερες από μία μεταβλητές, διαχωρίστε κάθε όνομα μεταβλητής με κόμμα. |
def main():
# Monitor the amount of loops
global loops
monitor_variable("loops")
# Drive forward 3 times
for loops in range(3):
drivetrain.drive_for(FORWARD, 200, MM)
# VR threads — Do not delete
vr_thread(main)
αισθητήρας_παρακολούθησης#
monitor_sensor adds one or more sensor values to the Monitor tab in VEXcode. This lets you watch sensor values change while a project is running.
Παρέχετε κάθε τιμή αισθητήρα ως συμβολοσειρά.
Usage:
monitor_sensor(“sensor”)
monitor_sensor(“sensor1”, “sensor2”)
Παράμετροι |
Περιγραφή |
|---|---|
|
The sensor value to monitor, given as a string. To monitor more than one sensor value, separate each sensor value with a comma. Supported sensor identifiers include:
|
def main():
# Monitor the rover's battery
monitor_sensor("rover.battery")
drivetrain.drive_for(FORWARD, 200, MM)
# VR threads — Do not delete
vr_thread(main)
Εξεύρεση της φόρας#
Απόσταση#
βρέθηκε_αντικείμενο#
found_object returns whether the Distance Sensor detects an object.
Usage:
distance.found_object()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
if distance.found_object():
brain.screen.print("Object detected")
# VR threads — Do not delete
vr_thread(main)
get_distance#
get_distance returns the distance to the nearest detected object from the Distance Sensor.
Usage:
distance.get_distance(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The distance unit: |
def main():
brain.screen.print(distance.get_distance(MM))
# VR threads — Do not delete
vr_thread(main)
Ενέργειες#
Ενέργειες#
βελτίωση#
pickup picks up minerals.
Usage:
rover.pickup(object)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object the VR Rover can pick up:
|
def main():
rover.pickup(MINERALS)
# VR threads — Do not delete
vr_thread(main)
πτώση#
drop drops carried minerals.
Usage:
rover.drop(object)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object the VR Rover can drop:
|
def main():
rover.drop(MINERALS)
# VR threads — Do not delete
vr_thread(main)
χρήση#
use uses minerals to restore energy. Minerals must be on the ground to be used.
Usage:
rover.use(object)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object the VR Rover can use:
|
def main():
rover.use(MINERALS)
# VR threads — Do not delete
vr_thread(main)
απορρόφηση_ακτινοβολίας#
absorb_radiation absorbs radiation from an enemy.
Usage:
rover.absorb_radiation(object)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object the VR Rover can absorb radiation from:
|
def main():
rover.absorb_radiation(ENEMY)
# VR threads — Do not delete
vr_thread(main)
αναμονή#
standby puts the VR Rover into standby mode until the specified battery threshold is reached.
Usage:
rover.standby(percent)
Παράμετροι |
Περιγραφή |
|---|---|
|
The battery threshold that causes the VR Rover to exit standby mode, from |
Εάν το επιλεγμένο όριο είναι ίσο ή υψηλότερο από το τρέχον επίπεδο μπαταρίας, το VR Rover δεν θα εισέλθει σε λειτουργία αναμονής.
def main():
rover.standby(50)
# VR threads — Do not delete
vr_thread(main)
Αποκτητές#
γωνία#
angle returns the direction in degrees to the selected object.
Usage:
rover.angle(object)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object to report the direction of:
|
Για ορυκτά και εχθρούς, το αντικείμενο πρέπει να βρίσκεται εντός 1000 mm και εντός του οπτικού πεδίου του VR Rover. Η βάση μπορεί πάντα να αναφερθεί.
def main():
brain.screen.print(rover.angle(MINERALS))
# VR threads — Do not delete
vr_thread(main)
get_distance#
get_distance returns the distance from the VR Rover to the selected object.
Usage:
rover.get_distance(object, units=MM)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object to report distance to:
|
|
Optional. The unit used to report the distance: |
Για ορυκτά και εχθρούς, το αντικείμενο πρέπει να βρίσκεται εντός 1000 mm και εντός του οπτικού πεδίου του VR Rover. Η βάση μπορεί πάντα να αναφερθεί.
For obstacles and hazards, the method reports the visible object distance. If none is in view, it returns 1000 mm or 39.37 inches.
def main():
brain.screen.print(rover.get_distance(MINERALS, MM))
# VR threads — Do not delete
vr_thread(main)
τοποθεσία#
location returns the X or Y coordinate location of the selected object.
Usage:
rover.location(object, axis, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object to report the location of:
|
|
Which coordinate to return:
|
|
The unit used to report the location: |
Για ορυκτά και εχθρούς, το αντικείμενο πρέπει να βρίσκεται εντός 1000 mm και εντός του οπτικού πεδίου του VR Rover. Η βάση μπορεί πάντα να αναφερθεί.
def main():
brain.screen.print(rover.location(MINERALS, X, MM))
# VR threads — Do not delete
vr_thread(main)
μπαταρία#
battery returns the current battery level of the VR Rover.
Usage:
rover.battery()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
brain.screen.print(rover.battery())
# VR threads — Do not delete
vr_thread(main)
ορυκτά_αποθηκευμένα#
minerals_stored returns the current amount of minerals the VR Rover has in storage.
Usage:
rover.minerals_stored()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
brain.screen.print(rover.minerals_stored())
# VR threads — Do not delete
vr_thread(main)
χωρητικότητα_αποθήκευσης#
storage_capacity returns the carrying capacity of the VR Rover.
Usage:
rover.storage_capacity()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
brain.screen.print(rover.storage_capacity())
# VR threads — Do not delete
vr_thread(main)
επίπεδο#
level returns the current level of the VR Rover.
Usage:
rover.level()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
brain.screen.print(rover.level())
# VR threads — Do not delete
vr_thread(main)
εμπειρία#
exp returns the number of Experience Points the VR Rover has at the current level.
Usage:
rover.exp()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
brain.screen.print(rover.exp())
# VR threads — Do not delete
vr_thread(main)
επίπεδο_εχθρού#
enemy_level returns the level of the closest enemy detected by the VR Rover.
Usage:
rover.enemy_level()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
When no enemy is detected within the rover’s detect radius, this method returns 0.
def main():
brain.screen.print(rover.enemy_level())
# VR threads — Do not delete
vr_thread(main)
εχθρική_ακτινοβολία#
enemy_radiation returns the radiation of the closest enemy detected by the VR Rover.
Usage:
rover.enemy_radiation()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
When no enemy is detected within the rover’s detect radius, this method returns 0.
def main():
brain.screen.print(rover.enemy_radiation())
# VR threads — Do not delete
vr_thread(main)
ανιχνεύει#
detects returns whether the VR Rover detects minerals or enemies in its detect radius.
Usage:
rover.detects(object)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object to detect:
|
Η ακτίνα ανίχνευσης του VR Rover είναι 800 mm.
def main():
if rover.detects(MINERALS):
brain.screen.print("Minerals detected")
# VR threads — Do not delete
vr_thread(main)
βλέπει#
sees returns whether the VR Rover sees the selected object in its vision range.
Usage:
rover.sees(object)
Παράμετροι |
Περιγραφή |
|---|---|
|
The object to see:
|
Το VR Rover μπορεί να δει αντικείμενα σε απόσταση 1000 mm και εντός του οπτικού πεδίου 40 μοιρών.
def main():
if rover.sees(MINERALS):
brain.screen.print("Minerals in view")
# VR threads — Do not delete
vr_thread(main)
υπό_επίθεση#
under_attack returns whether the VR Rover is currently under attack from an enemy.
Usage:
rover.under_attack()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
def main():
if rover.under_attack():
brain.screen.print("The rover is under attack!")
# VR threads — Do not delete
vr_thread(main)
Επανακλήσεις#
σε_επίθεση_#
on_under_attack registers a callback function that runs when the VR Rover takes damage from an enemy.
Usage:
rover.on_under_attack(callback)
Παράμετροι |
Περιγραφή |
|---|---|
|
Η συνάρτηση που θα εκτελείται όταν το VR Rover δέχεται επίθεση. |
def under_attack():
brain.screen.print("The rover is under attack!")
def main():
rover.on_under_attack(under_attack)
wait(0.15, SECONDS)
# VR threads — Do not delete
vr_thread(main)
σε_επίπεδο_ανώτερο#
on_level_up registers a callback function that runs when the VR Rover moves from one level to the next.
Usage:
rover.on_level_up(callback)
Παράμετροι |
Περιγραφή |
|---|---|
|
Η συνάρτηση που θα εκτελεστεί όταν το VR Rover ανέβει επίπεδο. |
def level_up():
brain.screen.print("The rover leveled up!")
def main():
rover.on_level_up(level_up)
wait(0.15, SECONDS)
# VR threads — Do not delete
vr_thread(main)