2022-08-14 08:03:07 +02:00
|
|
|
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
|
|
|
from rp_lib import * # Bibliothèque Ropy
|
|
|
|
|
|
|
|
###############################################################################
|
2022-08-19 15:43:20 +02:00
|
|
|
# rp_cmd.py
|
2022-08-26 12:41:18 +02:00
|
|
|
# @title: Commandes pour le Rover Ropy
|
2022-08-14 08:03:07 +02:00
|
|
|
# @project: Ropy (Blender-EduTech)
|
|
|
|
###############################################################################
|
|
|
|
|
2022-09-14 22:03:24 +02:00
|
|
|
###############################################################################
|
|
|
|
# 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
|
|
|
|
###############################################################################
|
|
|
|
|
2022-08-14 08:03:07 +02:00
|
|
|
###############################################################################
|
|
|
|
# Fonctions
|
|
|
|
###############################################################################
|
|
|
|
|
2022-08-26 01:58:49 +02:00
|
|
|
def mrp_avancer():
|
2022-09-22 06:44:37 +02:00
|
|
|
if rp_detect()==False:
|
|
|
|
rp_avancer()
|
|
|
|
rp_marquer()
|
2022-08-14 08:03:07 +02:00
|
|
|
|
2022-09-24 04:53:54 +02:00
|
|
|
def mrp_avancer_nbpas(pas):
|
|
|
|
for i in range (pas):
|
|
|
|
mrp_avancer()
|
|
|
|
|
|
|
|
def mrp_avancer_mur():
|
|
|
|
while rp_detect()==False:
|
|
|
|
mrp_avancer()
|
|
|
|
|
2022-08-14 08:03:07 +02:00
|
|
|
###############################################################################
|
|
|
|
# Commandes
|
|
|
|
###############################################################################
|
|
|
|
|
2022-10-03 14:02:01 +02:00
|
|
|
color_yellow = (1, 0.503, 0.018, 1)
|
|
|
|
color_black = (0.019794, 0.032076, 0.037408, 1)
|
|
|
|
color_white = (0.799, 0.799, 0.799, 1)
|
|
|
|
color_windows_red = (0.617, 0.037, 0.019, 1)
|
|
|
|
color_area_red = (1, 0.003, 0.012, 1) # Balise
|
|
|
|
color_light_red = (1, 0.003, 0.012, 1) # Balise
|
|
|
|
color_stone = (0.191, 0.227, 0.246, 1)
|
|
|
|
color_wooddark = (0.153, 0.117, 0.107, 1)
|
|
|
|
color_metal = (0.401, 0.478, 0.518, 1)
|
|
|
|
|
|
|
|
|
2022-08-26 12:41:18 +02:00
|
|
|
def commandes():
|
2022-08-14 08:03:07 +02:00
|
|
|
|
2022-10-03 14:02:01 +02:00
|
|
|
# rp_couleur("rover", 0)
|
|
|
|
# rp_couleur("rover", (0.5,0.5,0,1))
|
|
|
|
# print ("fini")
|
|
|
|
|
|
|
|
mrp_avancer()
|
|
|
|
rp_couleur("Balise", (1, 0.003, 0.012, 1))
|
|
|
|
rp_couleur("Rover 1", (1, 0.003, 0.012, 1))
|
|
|
|
mrp_avancer()
|
|
|
|
mrp_avancer()
|
|
|
|
mrp_avancer()
|
|
|
|
for i in range(10):
|
|
|
|
rp_couleur("Balise", (1, 0.503, 0.018, 1))
|
|
|
|
rp_tempo(0.1)
|
|
|
|
rp_couleur("Balise", (1, 0.003, 0.012, 1))
|
|
|
|
rp_tempo(0.1)
|
|
|
|
|
2022-09-30 06:59:52 +02:00
|
|
|
# rp_marquer()
|
|
|
|
# rp_gauche()
|
2022-10-03 14:02:01 +02:00
|
|
|
# rp_avancer()
|
|
|
|
# rp_avancer()
|
2022-09-30 06:59:52 +02:00
|
|
|
# mrp_avancer_mur()
|
|
|
|
# rp_gauche()
|
|
|
|
|
2022-10-03 14:02:01 +02:00
|
|
|
# # rp_vitesse (8)
|
|
|
|
# mrp_avancer_mur()
|
|
|
|
# rp_gauche()
|
|
|
|
# # rp_vitesse (1)
|
|
|
|
# mrp_avancer_mur()
|
2022-09-24 04:53:54 +02:00
|
|
|
|
2022-08-23 03:39:37 +02:00
|
|
|
rp_fin()
|
2022-08-22 21:56:46 +02:00
|
|
|
|
2022-08-14 08:03:07 +02:00
|
|
|
###############################################################################
|
|
|
|
# En: Externals calls << DONT CHANGE THIS SECTION >>
|
|
|
|
# Fr: Appels externes << NE PAS MODIFIER CETTE SECTION >>
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
if __name__=='start':
|
2022-08-26 12:41:18 +02:00
|
|
|
thread_cmd_start(commandes)
|
2022-08-14 08:03:07 +02:00
|
|
|
if __name__=='stop':
|
2022-08-23 03:39:37 +02:00
|
|
|
thread_cmd_stop()
|