ropy/rp_cmd.py

87 lines
2.3 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import bge # Bibliothèque Blender Game Engine (UPBGE)
import time
from rp_lib import * # Bibliothèque Ropy
###############################################################################
# rp_cmd.py
# @title: Commandes pour le Rover Ropy
# @project: Ropy (Blender-EduTech)
###############################################################################
###############################################################################
# Initialisation du niveau :
# Niveau 1 : Les premiers pas de Ropy
# Niveau 2 : Ma première fonction
# Niveau 3 : Sécuriser Ropy
# Niveau 4 : Partir au bout du monde
# Niveau 5 : Faire face à l'inconnu
# Niveau 6 : Se rendre utile
###############################################################################
###############################################################################
# Fonctions
###############################################################################
def mrp_marquer_couleur():
global j
rp_marquer()
time.sleep(1)
rp_couleur("Balise "+str(j), (j/100, j/100, 1, 1)) # Balise
j+=1
def mrp_avancer():
if rp_detect()==False:
rp_avancer()
rp_marquer()
# mrp_marquer_couleur()
def mrp_avancer_nbpas(pas):
for i in range (pas):
mrp_avancer()
def mrp_avancer_mur():
while rp_detect()==False:
mrp_avancer()
def mrp_avancer_mur_sb(): # sb = sans balise
while rp_detect()==False:
rp_avancer()
###############################################################################
# Commandes
###############################################################################
def commandes():
# Mission 6
rp_gauche()
mrp_avancer_mur_sb()
rp_droite()
mrp_avancer_mur_sb()
rp_gauche()
mrp_avancer_mur_sb()
rp_gauche()
for i in range (5):
mrp_avancer_nbpas(9)
rp_gauche()
mrp_avancer()
rp_gauche()
mrp_avancer_nbpas(9)
rp_droite()
mrp_avancer()
rp_droite()
rp_fin()
###############################################################################
# En: Externals calls << DONT CHANGE THIS SECTION >>
# Fr: Appels externes << NE PAS MODIFIER CETTE SECTION >>
###############################################################################
if __name__=='start':
thread_cmd_start(commandes)
if __name__=='stop':
thread_cmd_stop()