mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Gestion des niveaux.
This commit is contained in:
parent
895ee697e5
commit
8afa1e4703
BIN
ropy-16.blend
BIN
ropy-16.blend
Binary file not shown.
34
rp.py
34
rp.py
@ -159,6 +159,8 @@ def terrain_init ():
|
|||||||
beacon['activated']=False
|
beacon['activated']=False
|
||||||
|
|
||||||
# Init de la carte
|
# Init de la carte
|
||||||
|
# Read config (mission actuelle : data/mission/current -> [1][0].text)
|
||||||
|
scene.objects['Points']['mission']=int(rp_config_tree[1][0].text)
|
||||||
rp_map.map_init()
|
rp_map.map_init()
|
||||||
rp_map.map_reset()
|
rp_map.map_reset()
|
||||||
|
|
||||||
@ -269,6 +271,7 @@ def terrain_grid ():
|
|||||||
if scene.objects['Grid-u'].visible:
|
if scene.objects['Grid-u'].visible:
|
||||||
scene.objects['Grid-u'].setVisible(False,True)
|
scene.objects['Grid-u'].setVisible(False,True)
|
||||||
scene.objects['Grid-v'].setVisible(False,True)
|
scene.objects['Grid-v'].setVisible(False,True)
|
||||||
|
rp_map.aim_hide()
|
||||||
scene.objects['Map_aim'].setVisible(False,True)
|
scene.objects['Map_aim'].setVisible(False,True)
|
||||||
else:
|
else:
|
||||||
scene.objects['Grid-u']['timer'] = 0
|
scene.objects['Grid-u']['timer'] = 0
|
||||||
@ -286,7 +289,7 @@ def terrain_grid_anim ():
|
|||||||
# bpy.data.materials["Grid"].node_tree.nodes["Emission"].inputs[1].default_value =scene.objects['Grid-u']['timer']
|
# bpy.data.materials["Grid"].node_tree.nodes["Emission"].inputs[1].default_value =scene.objects['Grid-u']['timer']
|
||||||
scene.objects['Grid-u']['timer']+=0.01
|
scene.objects['Grid-u']['timer']+=0.01
|
||||||
if scene.objects['Grid-u']['timer']>= 0.05 and scene.objects['Grid-u'].visible :
|
if scene.objects['Grid-u']['timer']>= 0.05 and scene.objects['Grid-u'].visible :
|
||||||
scene.objects['Map_aim'].setVisible(True,True)
|
rp_map.aim_show()
|
||||||
if scene.objects['Grid-u']['timer']>= 1:
|
if scene.objects['Grid-u']['timer']>= 1:
|
||||||
scene.objects['Grid-u']['anim'] = False
|
scene.objects['Grid-u']['anim'] = False
|
||||||
|
|
||||||
@ -398,18 +401,22 @@ def cmd_init():
|
|||||||
i=speed_mode.index(scene.objects['Commands']['speed'])
|
i=speed_mode.index(scene.objects['Commands']['speed'])
|
||||||
scene.objects['Text_speed']['Text']=speed_mode_txt[i]
|
scene.objects['Text_speed']['Text']=speed_mode_txt[i]
|
||||||
|
|
||||||
|
# Missions
|
||||||
|
# Read config (mission actuelle : data/mission/current -> [1][0].text)
|
||||||
|
# Read config (niveau atteint : data/mission/level -> [1][1].text)
|
||||||
|
scene.objects['Points']['mission']=int(rp_config_tree[1][0].text)
|
||||||
|
scene.objects['Points']['mission_init']= scene.objects['Points']['mission']
|
||||||
|
scene.objects['Points']['level']=int(rp_config_tree[1][1].text)
|
||||||
|
scene.objects['Points-Map-text']['Text']="Mission "+str(scene.objects['Points']['mission'])
|
||||||
|
scene.objects['Book_mission']['Text'] = "Mission en cours : "+str(scene.objects['Points']['mission'])
|
||||||
|
scene.objects['Book_level']['Text'] = "Niveau actuel : "+str(scene.objects['Points']['level'])
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About")
|
windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About")
|
||||||
for window in windows:
|
for window in windows:
|
||||||
scene.objects[window].setVisible(False,True)
|
scene.objects[window].setVisible(False,True)
|
||||||
rp_doc.init()
|
rp_doc.init()
|
||||||
|
|
||||||
# Missions
|
|
||||||
# Read config (mission actuelle : data/config/mission_current -> [1][0].text)
|
|
||||||
# Read config (niveau atteint : data/config/mission_success -> [1][1].text)
|
|
||||||
scene.objects['Terrain']['mission_current']=int(rp_config_tree[1][0].text)
|
|
||||||
scene.objects['Terrain']['mission_success']=int(rp_config_tree[1][1].text)
|
|
||||||
scene.objects['Points-Map-text']['Text']="Mission "+str(scene.objects['Terrain']['mission_current'])
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Highlight des commandes
|
# Highlight des commandes
|
||||||
@ -891,6 +898,12 @@ def tablet_close ():
|
|||||||
rp_doc.close()
|
rp_doc.close()
|
||||||
scene.objects['Terrain']['manip_mode']=0 # Enlever la fenêtre modale
|
scene.objects['Terrain']['manip_mode']=0 # Enlever la fenêtre modale
|
||||||
|
|
||||||
|
# Maj du fichier de config (mission actuelle : data/mission/current -> [1][0].text)
|
||||||
|
rp_config_tree[1][0].text=str(scene.objects['Points']['mission'])
|
||||||
|
buffer_xml = ET.tostring(rp_config_tree)
|
||||||
|
with open("rp_config.xml", "wb") as f:
|
||||||
|
f.write(buffer_xml)
|
||||||
|
|
||||||
# Overlay
|
# Overlay
|
||||||
scene.objects['Points'].setVisible(True,True)
|
scene.objects['Points'].setVisible(True,True)
|
||||||
scene.objects['Commands'].setVisible(True,True)
|
scene.objects['Commands'].setVisible(True,True)
|
||||||
@ -925,6 +938,13 @@ def tablet_close ():
|
|||||||
scene.objects['Camera'].worldPosition.y = scene.objects['Camera']['current_ly']
|
scene.objects['Camera'].worldPosition.y = scene.objects['Camera']['current_ly']
|
||||||
scene.objects['Camera'].worldPosition.z = scene.objects['Camera']['current_lz']
|
scene.objects['Camera'].worldPosition.z = scene.objects['Camera']['current_lz']
|
||||||
|
|
||||||
|
# Reset si changement de mission
|
||||||
|
if scene.objects['Points']['mission_init']!= scene.objects['Points']['mission']:
|
||||||
|
terrain_stop ()
|
||||||
|
if scene.objects['Grid-u'].visible:
|
||||||
|
rp_map.aim_show()
|
||||||
|
scene.objects['Points']['mission_init'] = scene.objects['Points']['mission']
|
||||||
|
|
||||||
##
|
##
|
||||||
# Clic pour fermer la tablette
|
# Clic pour fermer la tablette
|
||||||
##
|
##
|
||||||
|
@ -41,7 +41,7 @@ def commandes():
|
|||||||
mrp_avancer()
|
mrp_avancer()
|
||||||
mrp_avancer()
|
mrp_avancer()
|
||||||
mrp_avancer()
|
mrp_avancer()
|
||||||
# mrp_avancer()
|
mrp_avancer()
|
||||||
# mrp_avancer()
|
# mrp_avancer()
|
||||||
|
|
||||||
rp_droite()
|
rp_droite()
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<data>
|
<data>
|
||||||
<config>
|
<config>
|
||||||
<speed>1.0</speed>
|
<speed>4.0</speed>
|
||||||
<sound>False</sound>
|
<sound>False</sound>
|
||||||
<cam>
|
<cam>
|
||||||
<worldPosition.x>-6.930208683013916</worldPosition.x>
|
<worldPosition.x>-5.5672173500061035</worldPosition.x>
|
||||||
<worldPosition.y>-18.326568603515625</worldPosition.y>
|
<worldPosition.y>-15.25645923614502</worldPosition.y>
|
||||||
<worldPosition.z>19.9746036529541</worldPosition.z>
|
<worldPosition.z>13.960037231445312</worldPosition.z>
|
||||||
</cam>
|
</cam>
|
||||||
</config>
|
</config>
|
||||||
<mission>
|
<mission>
|
||||||
<current>1</current>
|
<current>3</current>
|
||||||
<success>0</success>
|
<level>6</level>
|
||||||
</mission>
|
</mission>
|
||||||
</data>
|
</data>
|
77
rp_doc.py
77
rp_doc.py
@ -144,7 +144,7 @@ card_description.update({"poo-card" : [rp_poo_title, rp_poo_text]})
|
|||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
|
||||||
# Mettre les couleurs par défaut sur les icones (chapitres et cartes)
|
# Mettre les couleurs sur les icones (chapitres et cartes)
|
||||||
chap=("general", "missions", "rover", "python")
|
chap=("general", "missions", "rover", "python")
|
||||||
for page in chap:
|
for page in chap:
|
||||||
scene.objects["Doc-"+page].color = color_doc_chap
|
scene.objects["Doc-"+page].color = color_doc_chap
|
||||||
@ -161,6 +161,11 @@ def init():
|
|||||||
scene.objects[python_card[i]].color = color_doc_fct
|
scene.objects[python_card[i]].color = color_doc_fct
|
||||||
scene.objects[python_card[i]+"-icon"].color = color_doc_fct
|
scene.objects[python_card[i]+"-icon"].color = color_doc_fct
|
||||||
scene.objects[python_card[i]+"-text"].color = color_doc_fct
|
scene.objects[python_card[i]+"-text"].color = color_doc_fct
|
||||||
|
scene.objects['Book_level_button'].color = color_doc_chap
|
||||||
|
scene.objects['Book_level_button'].setVisible(False,True)
|
||||||
|
scene.objects["mission_"+str(scene.objects['Points']['mission'])+"-card"].color = color_doc_mission
|
||||||
|
scene.objects["mission_"+str(scene.objects['Points']['mission'])+"-card-icon"].color = color_doc_mission
|
||||||
|
scene.objects["mission_"+str(scene.objects['Points']['mission'])+"-card-text"].color = color_doc_mission
|
||||||
|
|
||||||
# Mémorisation de la position des pages
|
# Mémorisation de la position des pages
|
||||||
chap=("general", "missions", "rover", "python")
|
chap=("general", "missions", "rover", "python")
|
||||||
@ -193,11 +198,16 @@ def open():
|
|||||||
scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition
|
scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition
|
||||||
scene.objects['Doc_chap-'+name_chap].setVisible(True,True)
|
scene.objects['Doc_chap-'+name_chap].setVisible(True,True)
|
||||||
|
|
||||||
# Placer la carte de la mission active
|
# Affichage ou pas du bouton de selection de la mission
|
||||||
if name_chap == "missions":
|
if name_chap == "missions":
|
||||||
scene.objects["mission_"+str(scene.objects['Terrain']['mission_current'])+"-card"].color = color_doc_mission
|
name_fct = scene.objects['Doc_chap-missions']['page_fct']
|
||||||
scene.objects["mission_"+str(scene.objects['Terrain']['mission_current'])+"-card-icon"].color = color_doc_mission
|
if name_fct !="":
|
||||||
scene.objects["mission_"+str(scene.objects['Terrain']['mission_current'])+"-card-text"].color = color_doc_mission
|
if scene.objects[name_fct]['mission'] <= scene.objects['Points']['level'] and scene.objects[name_fct]['mission'] != scene.objects['Points']['mission']:
|
||||||
|
scene.objects['Book_level_button'].setVisible(True,True)
|
||||||
|
else:
|
||||||
|
scene.objects['Book_level_button'].setVisible(False,True)
|
||||||
|
else:
|
||||||
|
scene.objects['Book_level_button'].setVisible(False,True)
|
||||||
|
|
||||||
# Afficher le texte de la carte active
|
# Afficher le texte de la carte active
|
||||||
if name_chap != "general":
|
if name_chap != "general":
|
||||||
@ -211,8 +221,12 @@ def open():
|
|||||||
scene.objects['Doc_title'].setVisible(False,True)
|
scene.objects['Doc_title'].setVisible(False,True)
|
||||||
scene.objects['Doc_text'].setVisible(False,True)
|
scene.objects['Doc_text'].setVisible(False,True)
|
||||||
else:
|
else:
|
||||||
scene.objects['Doc_title'].setVisible(False,True)
|
if name_chap != "missions":
|
||||||
scene.objects['Doc_text'].setVisible(False,True)
|
scene.objects['Doc_title'].setVisible(False,True)
|
||||||
|
scene.objects['Doc_text'].setVisible(False,True)
|
||||||
|
else:
|
||||||
|
scene.objects['Doc_title'].setVisible(False,True)
|
||||||
|
scene.objects['Doc_text'].setVisible(False,True)
|
||||||
|
|
||||||
##
|
##
|
||||||
# Fermeture du livre
|
# Fermeture du livre
|
||||||
@ -243,7 +257,7 @@ def hl (cont):
|
|||||||
name_icon=name+"-icon"
|
name_icon=name+"-icon"
|
||||||
|
|
||||||
# Close
|
# Close
|
||||||
if name == "Doc_close" :
|
if name == "Doc_close" or name == "Book_level_button":
|
||||||
scene.objects[name].color = color_doc_hl
|
scene.objects[name].color = color_doc_hl
|
||||||
else:
|
else:
|
||||||
if "Doc-" in name : # Chapitre
|
if "Doc-" in name : # Chapitre
|
||||||
@ -272,7 +286,7 @@ def hl (cont):
|
|||||||
name_icon=obj.name[:-7]+"-icon"
|
name_icon=obj.name[:-7]+"-icon"
|
||||||
|
|
||||||
# Close
|
# Close
|
||||||
if name == "Doc_close" :
|
if name == "Doc_close" or name == "Book_level_button":
|
||||||
scene.objects[name].color = color_doc_fct
|
scene.objects[name].color = color_doc_fct
|
||||||
else:
|
else:
|
||||||
if "Doc-" in name : # Chapitre
|
if "Doc-" in name : # Chapitre
|
||||||
@ -289,7 +303,7 @@ def hl (cont):
|
|||||||
scene.objects[name_text].color = color_doc_activate
|
scene.objects[name_text].color = color_doc_activate
|
||||||
scene.objects[name_icon].color = color_doc_activate
|
scene.objects[name_icon].color = color_doc_activate
|
||||||
else:
|
else:
|
||||||
if name == "mission_"+str(scene.objects['Terrain']['mission_current'])+"-card":
|
if name == "mission_"+str(scene.objects['Points']['mission'])+"-card":
|
||||||
scene.objects[name].color = color_doc_mission
|
scene.objects[name].color = color_doc_mission
|
||||||
scene.objects[name_text].color = color_doc_mission
|
scene.objects[name_text].color = color_doc_mission
|
||||||
scene.objects[name_icon].color = color_doc_mission
|
scene.objects[name_icon].color = color_doc_mission
|
||||||
@ -322,11 +336,16 @@ def chapter(cont):
|
|||||||
scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition
|
scene.objects['Doc_chap-'+name_chap].worldPosition = scene.objects['Doc'].worldPosition
|
||||||
scene.objects['Doc_chap-'+name_chap].setVisible(True,True)
|
scene.objects['Doc_chap-'+name_chap].setVisible(True,True)
|
||||||
|
|
||||||
# Placer la carte de la mission active
|
# Bouton de selection de la mission
|
||||||
if name_chap == "missions":
|
if name_chap == "missions":
|
||||||
scene.objects["mission_"+str(scene.objects['Terrain']['mission_current'])+"-card"].color = color_doc_mission
|
name_fct = scene.objects['Doc_chap-missions']['page_fct']
|
||||||
scene.objects["mission_"+str(scene.objects['Terrain']['mission_current'])+"-card-icon"].color = color_doc_mission
|
if name_fct !="":
|
||||||
scene.objects["mission_"+str(scene.objects['Terrain']['mission_current'])+"-card-text"].color = color_doc_mission
|
if scene.objects[name_fct]['mission'] <= scene.objects['Points']['level'] and scene.objects[name_fct]['mission'] != scene.objects['Points']['mission']:
|
||||||
|
scene.objects['Book_level_button'].setVisible(True,True)
|
||||||
|
else:
|
||||||
|
scene.objects['Book_level_button'].setVisible(False,True)
|
||||||
|
else:
|
||||||
|
scene.objects['Book_level_button'].setVisible(False,True)
|
||||||
|
|
||||||
# Afficher le texte de la carte active
|
# Afficher le texte de la carte active
|
||||||
if name_chap != "general":
|
if name_chap != "general":
|
||||||
@ -361,7 +380,7 @@ def card (cont):
|
|||||||
if scene.objects['Doc_chap-'+name_chap]['page_fct'] !="":
|
if scene.objects['Doc_chap-'+name_chap]['page_fct'] !="":
|
||||||
|
|
||||||
# Placer la carte de la mission active
|
# Placer la carte de la mission active
|
||||||
if scene.objects['Doc_chap-'+name_chap]['page_fct'] == "mission_"+str(scene.objects['Terrain']['mission_current'])+"-card":
|
if scene.objects['Doc_chap-'+name_chap]['page_fct'] == "mission_"+str(scene.objects['Points']['mission'])+"-card":
|
||||||
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']].color = color_doc_mission
|
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']].color = color_doc_mission
|
||||||
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']+'-text'].color = color_doc_mission
|
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']+'-text'].color = color_doc_mission
|
||||||
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']+'-icon'].color = color_doc_mission
|
scene.objects[scene.objects['Doc_chap-'+name_chap]['page_fct']+'-icon'].color = color_doc_mission
|
||||||
@ -380,6 +399,34 @@ def card (cont):
|
|||||||
scene.objects['Doc_title'].setVisible(True, False)
|
scene.objects['Doc_title'].setVisible(True, False)
|
||||||
scene.objects['Doc_text'].setVisible(True, False)
|
scene.objects['Doc_text'].setVisible(True, False)
|
||||||
|
|
||||||
|
# Sélection de la mission
|
||||||
|
if "mission_" in name_fct :
|
||||||
|
if scene.objects[name_fct]['mission'] <= scene.objects['Points']['level'] and scene.objects[name_fct]['mission'] != scene.objects['Points']['mission']:
|
||||||
|
scene.objects['Book_level_button'].setVisible(True,True)
|
||||||
|
else:
|
||||||
|
scene.objects['Book_level_button'].setVisible(False,True)
|
||||||
|
|
||||||
|
##
|
||||||
|
# Sélectionner le niveau
|
||||||
|
##
|
||||||
|
|
||||||
|
def level_button (cont):
|
||||||
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
|
# sound_play (sndbuff_book_flip)
|
||||||
|
obj = cont.owner
|
||||||
|
name_fct = scene.objects['Doc_chap-missions']['page_fct']
|
||||||
|
if name_fct !="":
|
||||||
|
mission_select=scene.objects[name_fct]['mission']
|
||||||
|
if mission_select <= scene.objects['Points']['level'] and mission_select != scene.objects['Points']['mission']:
|
||||||
|
scene.objects["mission_"+str(scene.objects['Points']['mission'])+"-card"].color = color_doc_fct
|
||||||
|
scene.objects["mission_"+str(scene.objects['Points']['mission'])+"-card-icon"].color = color_doc_fct
|
||||||
|
scene.objects["mission_"+str(scene.objects['Points']['mission'])+"-card-text"].color = color_doc_fct
|
||||||
|
print ("Sélectionner le niveau :", str(mission_select))
|
||||||
|
scene.objects['Points']['mission'] = mission_select
|
||||||
|
scene.objects['Points-Map-text']['Text']="Mission "+str(scene.objects['Points']['mission'])
|
||||||
|
scene.objects['Book_mission']['Text'] = "Mission en cours : "+str(scene.objects['Points']['mission'])
|
||||||
|
scene.objects['Book_level_button'].setVisible(False,True)
|
||||||
|
|
||||||
##
|
##
|
||||||
# Sounds
|
# Sounds
|
||||||
##
|
##
|
||||||
|
@ -9,6 +9,8 @@ import math
|
|||||||
import mathutils
|
import mathutils
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
import rp_map1 as rp_map # Map definition
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# rp_lib.py
|
# rp_lib.py
|
||||||
# @title: Bibliothèque du Rover Ropy (rp_*)
|
# @title: Bibliothèque du Rover Ropy (rp_*)
|
||||||
@ -234,7 +236,7 @@ def rp_avancer ():
|
|||||||
rp_tempo (0.1)
|
rp_tempo (0.1)
|
||||||
|
|
||||||
# Contrôle objectif
|
# Contrôle objectif
|
||||||
if [x1,y1] in scene.objects['Terrain']['map_aim']:
|
if rp_map.objectif_control(x1,y1):
|
||||||
print ("Goal !!")
|
print ("Goal !!")
|
||||||
rover_goal ()
|
rover_goal ()
|
||||||
obj['stop'] = True
|
obj['stop'] = True
|
||||||
@ -292,7 +294,7 @@ def rp_avancer ():
|
|||||||
rp_tempo (0.1)
|
rp_tempo (0.1)
|
||||||
|
|
||||||
# Contrôle objectif
|
# Contrôle objectif
|
||||||
if [x1,y1] in scene.objects['Terrain']['map_aim']:
|
if rp_map.objectif_control(x1,y1):
|
||||||
print ("Goal !!")
|
print ("Goal !!")
|
||||||
rover_goal ()
|
rover_goal ()
|
||||||
obj['stop'] = True
|
obj['stop'] = True
|
||||||
|
66
rp_map1.py
66
rp_map1.py
@ -23,18 +23,15 @@ scene = bge.logic.getCurrentScene()
|
|||||||
missions_card_description ={}
|
missions_card_description ={}
|
||||||
missions_conf ={}
|
missions_conf ={}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Initialisation du niveau :
|
# Initialisation du niveau :
|
||||||
# Niveau 0 : Vide
|
# Niveau 1 : Les premiers pas de Ropy
|
||||||
# Niveau 1 : Les premiers pas de Ropy
|
# Niveau 2 : Ma première fonction
|
||||||
# Niveau 2 : Sécuriser Ropy
|
# Niveau 3 : Sécuriser Ropy
|
||||||
# Niveau 3 : Partir au bout du monde
|
# Niveau 4 : Partir au bout du monde
|
||||||
# Niveau 4 : Faire face à l'inconnu
|
# Niveau 5 : Faire face à l'inconnu
|
||||||
# Niveau 5 : Se rendre utile
|
# Niveau 6 : Se rendre utile
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# rp_niveau (1) # Saisir le niveau (de 0 à 5)
|
|
||||||
# ropy_init.main() # Initialisation de la scène 3D
|
|
||||||
|
|
||||||
missions_card=["mission_1-card", "mission_2-card", "mission_3-card", "mission_4-card", "mission_5-card", "mission_6-card"]
|
missions_card=["mission_1-card", "mission_2-card", "mission_3-card", "mission_4-card", "mission_5-card", "mission_6-card"]
|
||||||
# missions_card=["mission_1-card", "mission_2-card", "mission_3-card", "mission_4-card", "mission_5-card", "mission_6-card", "mission_7-card", "mission_8-card"]
|
# missions_card=["mission_1-card", "mission_2-card", "mission_3-card", "mission_4-card", "mission_5-card", "mission_6-card", "mission_7-card", "mission_8-card"]
|
||||||
@ -64,7 +61,7 @@ mission_3_title="Mission 3\n Apprendre le danger"
|
|||||||
mission_3_text="\n \n Tout d'abords, il faut provoquer une \n collision avec un obstacle (pente \n ou station) et observer ce qui se \n passe.\n \n"
|
mission_3_text="\n \n Tout d'abords, il faut provoquer une \n collision avec un obstacle (pente \n ou station) et observer ce qui se \n passe.\n \n"
|
||||||
mission_3_text= mission_3_text + " Il faut donc sécuriser Ropy en utilisant \n une structure alternative. \n -> Voir onglet Python, page \"Si alors\" \n -> Voir onglet Rover, page \"Détecter\" \n \n"
|
mission_3_text= mission_3_text + " Il faut donc sécuriser Ropy en utilisant \n une structure alternative. \n -> Voir onglet Python, page \"Si alors\" \n -> Voir onglet Rover, page \"Détecter\" \n \n"
|
||||||
mission_3_init=[-11.0,3.0, "e"] # Rover init position (x,y), orientation ("n|s|e|w")
|
mission_3_init=[-11.0,3.0, "e"] # Rover init position (x,y), orientation ("n|s|e|w")
|
||||||
mission_3_aim=[] # Aim position (x,y)
|
mission_3_aim=[100.0,100.0] # Aim caché
|
||||||
missions_card_description.update({"mission_3-card" : [mission_3_title, mission_3_text]})
|
missions_card_description.update({"mission_3-card" : [mission_3_title, mission_3_text]})
|
||||||
missions_conf.update({"3" : [mission_3_init, mission_3_aim]})
|
missions_conf.update({"3" : [mission_3_init, mission_3_aim]})
|
||||||
|
|
||||||
@ -72,8 +69,8 @@ missions_conf.update({"3" : [mission_3_init, mission_3_aim]})
|
|||||||
mission_4_title="Mission 4\n Partir au bout du monde"
|
mission_4_title="Mission 4\n Partir au bout du monde"
|
||||||
mission_4_text="\n \n Ropy est maintenant prêt pour \n l'aventure soit atteindre la case \n du nouvel objectif (loin, très loin ...). \n \n Pour un tel voyage, l'utilisation \n d'une boucle s'impose. \n"
|
mission_4_text="\n \n Ropy est maintenant prêt pour \n l'aventure soit atteindre la case \n du nouvel objectif (loin, très loin ...). \n \n Pour un tel voyage, l'utilisation \n d'une boucle s'impose. \n"
|
||||||
mission_4_text= mission_4_text +" -> Voir onglet Python, page \"Boucle\" \n \n \n \n \n"
|
mission_4_text= mission_4_text +" -> Voir onglet Python, page \"Boucle\" \n \n \n \n \n"
|
||||||
mission_4_init=[-11.0,3.0, "e"] # Rover init position (x,y), orientation ("n|s|e|w")
|
mission_4_init=[-7.0,4.0, "s"] # Rover init position (x,y), orientation ("n|s|e|w")
|
||||||
mission_4_aim=[9.0,11.0] # Aim position (x,y)
|
mission_4_aim=[12.0,9.0] # Aim position (x,y)
|
||||||
missions_card_description.update({"mission_4-card" : [mission_4_title, mission_4_text]})
|
missions_card_description.update({"mission_4-card" : [mission_4_title, mission_4_text]})
|
||||||
missions_conf.update({"4" : [mission_4_init, mission_4_aim]})
|
missions_conf.update({"4" : [mission_4_init, mission_4_aim]})
|
||||||
|
|
||||||
@ -83,8 +80,8 @@ mission_5_text="\n \n La case à atteindre est toujours la \n même, mais le lie
|
|||||||
mission_5_text= mission_5_text +" Pour pallier à l\'aléatoire, vous \n utiliserez les pentes (obstacle) du \n terrain."
|
mission_5_text= mission_5_text +" Pour pallier à l\'aléatoire, vous \n utiliserez les pentes (obstacle) du \n terrain."
|
||||||
mission_5_text= mission_5_text +" Il faudra alors créer une \n fonction avec une boucle \"tant que\" \n qui permet d'avancer jusqu'à un \n obstacle :"
|
mission_5_text= mission_5_text +" Il faudra alors créer une \n fonction avec une boucle \"tant que\" \n qui permet d'avancer jusqu'à un \n obstacle :"
|
||||||
mission_5_text= mission_5_text +" \"mrp_avancer_mur()\". \n \n \n"
|
mission_5_text= mission_5_text +" \"mrp_avancer_mur()\". \n \n \n"
|
||||||
mission_5_init=[-11.0,3.0, "e"] # Rover init position (x,y), orientation ("n|s|e|w")
|
mission_5_init=[-7.0,4.0, "s"] # Rover init position (x,y), orientation ("n|s|e|w")
|
||||||
mission_5_aim=[9.0,11.0] # Aim position (x,y)
|
mission_5_aim=[12.0,9.0] # Aim position (x,y)
|
||||||
missions_card_description.update({"mission_5-card" : [mission_5_title, mission_5_text]})
|
missions_card_description.update({"mission_5-card" : [mission_5_title, mission_5_text]})
|
||||||
missions_conf.update({"5" : [mission_5_init, mission_5_aim]})
|
missions_conf.update({"5" : [mission_5_init, mission_5_aim]})
|
||||||
|
|
||||||
@ -92,7 +89,7 @@ missions_conf.update({"5" : [mission_5_init, mission_5_aim]})
|
|||||||
mission_6_title="Mission 6\n Se rendre utile"
|
mission_6_title="Mission 6\n Se rendre utile"
|
||||||
mission_6_text="\n \n Une zone précise du terrain présente \n des pierres à analyser. \n \n Elles apparaissent de manière \n aléatoire (encore ...), pour les \n ramasser, Ropy doit passer sur toutes \n les cases de la zone. \n \n \n \n \n \n \n"
|
mission_6_text="\n \n Une zone précise du terrain présente \n des pierres à analyser. \n \n Elles apparaissent de manière \n aléatoire (encore ...), pour les \n ramasser, Ropy doit passer sur toutes \n les cases de la zone. \n \n \n \n \n \n \n"
|
||||||
mission_6_init=[-11.0,3.0, "e"] # Rover init position (x,y), orientation ("n|s|e|w")
|
mission_6_init=[-11.0,3.0, "e"] # Rover init position (x,y), orientation ("n|s|e|w")
|
||||||
mission_6_aim=[9.0,11.0] # Aim position (x,y)
|
mission_6_aim=[9.0,11.0] # Aim position (x,y) # FIXME plusieurs objectifs avec des positions aléatoires
|
||||||
missions_card_description.update({"mission_6-card" : [mission_6_title, mission_6_text]})
|
missions_card_description.update({"mission_6-card" : [mission_6_title, mission_6_text]})
|
||||||
missions_conf.update({"6" : [mission_6_init, mission_6_aim]})
|
missions_conf.update({"6" : [mission_6_init, mission_6_aim]})
|
||||||
|
|
||||||
@ -149,12 +146,8 @@ def map_init():
|
|||||||
def map_reset():
|
def map_reset():
|
||||||
scene.objects['Points']['step']=0
|
scene.objects['Points']['step']=0
|
||||||
scene.objects['Points']['nbligne']=0
|
scene.objects['Points']['nbligne']=0
|
||||||
scene.objects['Points']['level'] = 1
|
mission_init = missions_conf[str(scene.objects['Points']['mission'])][0]
|
||||||
|
mission_aim = missions_conf[str(scene.objects['Points']['mission'])][1]
|
||||||
# Mission
|
|
||||||
if scene.objects['Terrain']['mission_current']==1:
|
|
||||||
mission_init= mission_1_init
|
|
||||||
mission_aim= mission_1_aim
|
|
||||||
|
|
||||||
# Cacher les balises
|
# Cacher les balises
|
||||||
for i in range (100):
|
for i in range (100):
|
||||||
@ -184,6 +177,31 @@ def map_reset():
|
|||||||
obj_aim.worldPosition.y = mission_aim[1]
|
obj_aim.worldPosition.y = mission_aim[1]
|
||||||
obj_aim.worldPosition.z = 0.5
|
obj_aim.worldPosition.z = 0.5
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Objectif
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def aim_show():
|
||||||
|
if scene.objects['Points']['mission']==3 :
|
||||||
|
scene.objects['Map_aim'].setVisible(False,True)
|
||||||
|
else:
|
||||||
|
scene.objects['Map_aim'].setVisible(True,True)
|
||||||
|
|
||||||
|
def aim_hide():
|
||||||
|
scene.objects['Map_aim'].setVisible(False,True)
|
||||||
|
|
||||||
|
def objectif_control(x,y):
|
||||||
|
if scene.objects['Points']['mission']==3:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if [x,y] in scene.objects['Terrain']['map_aim']:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Fonction bas niveau
|
# Fonction bas niveau
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user