diff --git a/ropy-34.blend b/ropy-34.blend index 61942a0..09c4563 100644 Binary files a/ropy-34.blend and b/ropy-34.blend differ diff --git a/ropy-35.blend b/ropy-35.blend new file mode 100644 index 0000000..2bab3f5 Binary files /dev/null and b/ropy-35.blend differ diff --git a/rp.py b/rp.py index 719dc7c..02cf75d 100644 --- a/rp.py +++ b/rp.py @@ -135,6 +135,7 @@ def terrain_init (cont): # Ajout du Hud scene.active_camera = scene.objects["Camera"] scene.objects['Sun'].setVisible(True,True) + # FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud']) # Mémorisation des positions par défaut @@ -508,13 +509,13 @@ def cmd_init(cont): # Upgrade # Read config (upgrades choisis : data/upgrade/ -> [2][i].text) upgrade_card=("battery", "beacon", "paint", "speed") - scene.objects['Points']['upgrade_nb'] =0 + # scene.objects['Points']['upgrade_nb'] =0 for i in range(len(upgrade_card)): if rp_config_tree[2][i].text == "True": scene.objects['Points']['upgrade_'+upgrade_card[i]]=True - scene.objects['Points']['upgrade_nb'] +=1 - scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True - scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb'] + # scene.objects['Points']['upgrade_nb'] +=1 + # scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True + # scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb'] upgrade_maj() # Speed @@ -1079,6 +1080,7 @@ def tablet_open (): scene.objects['Cmd-text']['Text']= "" # Overlay + # FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra scene.removeOverlayCollection(bpy.data.collections['Hud']) scene.objects['Points'].setVisible(False,True) scene.objects['Commands'].setVisible(False,True) @@ -1112,6 +1114,7 @@ def tablet_close (): scene.objects['Commands'].setVisible(True,True) scene.objects['Camera'].setVisible(True,True) scene.active_camera = scene.objects["Camera"] + # FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud']) # UI : Commands @@ -1330,11 +1333,9 @@ def store_close(): # Maj du fichier de config (upgrade : data/upgrade/i -> [2][i].text) upgrade_card=("battery", "beacon", "paint", "speed") for i in range(len(upgrade_card)): - if scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] == True: - scene.objects['Points']["upgrade_"+upgrade_card[i]]=True + if scene.objects['Points']["upgrade_"+upgrade_card[i]]: rp_config_tree[2][i].text="True" else: - scene.objects['Points']["upgrade_"+upgrade_card[i]]=False rp_config_tree[2][i].text="False" config_save() @@ -1349,6 +1350,7 @@ def store_close(): scene.objects['Commands'].setVisible(True,True) scene.objects['Camera'].setVisible(True,True) scene.active_camera = scene.objects["Camera"] + # FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud']) # UI : Commands @@ -1521,16 +1523,16 @@ def config_load(): # Upgrade upgrade_card=("battery", "beacon", "paint", "speed") - scene.objects['Points']['upgrade_nb'] =0 + # scene.objects['Points']['upgrade_nb'] =0 for i in range(len(upgrade_card)): if rp_config_tree[2][i].text == "True": scene.objects['Points']['upgrade_'+upgrade_card[i]]=True - scene.objects['Points']['upgrade_nb'] +=1 - scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True + # scene.objects['Points']['upgrade_nb'] +=1 + # scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True else: scene.objects['Points']['upgrade_'+upgrade_card[i]]=False - scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = False - scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb'] + # scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = False + # scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb'] upgrade_maj() # Speed diff --git a/rp_about.py b/rp_about.py index c485cf7..2330ae1 100644 --- a/rp_about.py +++ b/rp_about.py @@ -192,6 +192,7 @@ def credits(cont): scene.objects["Credits"]['init_lz']=scene.objects["Credits"].worldPosition.z # Overlay + # FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra scene.removeOverlayCollection(bpy.data.collections['Hud']) scene.objects['Points'].setVisible(False,True) scene.objects['Commands'].setVisible(False,True) @@ -242,6 +243,7 @@ def credits_close(cont): scene.objects['Commands'].setVisible(True,True) scene.objects['Camera'].setVisible(True,True) scene.active_camera = scene.objects["Camera"] + # FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud']) # UI : Commands diff --git a/rp_cmd.py b/rp_cmd.py index 4f2e685..bfa6dd2 100644 --- a/rp_cmd.py +++ b/rp_cmd.py @@ -25,35 +25,16 @@ from rp_lib import * # Bibliothèque Ropy # Commandes ############################################################################### -def mrp_avancer(): - pass - def commandes(): - print ('Go go go ...') - - mrp_avancer() - mrp_avancer() - mrp_avancer() - - while True: - rp_droite() - - # while rp_detect()==False: - # rp_avancer() - # rp_droite() - # while rp_detect()==False: - # rp_avancer() - - # rp_avancer() - # rp_droite() - # for i in range (4): - # rp_avancer() - # rp_marquer() - # rp_droite() - # for i in range (3): - # rp_avancer() - # rp_marquer() + rp_gauche() + for i in range (2): + rp_avancer() + rp_marquer() + rp_droite() + for i in range (4): + rp_avancer() + rp_marquer() ############################################################################### # En: External call << DONT CHANGE THIS SECTION >> diff --git a/rp_config.xml b/rp_config.xml index ec03aeb..78e2efa 100644 --- a/rp_config.xml +++ b/rp_config.xml @@ -1,11 +1,11 @@ - 4.0 + 1.0 False - 2.3307816982269287 - -43.80031204223633 - 36.77288055419922 + 0.0057830810546875 + -39.4045524597168 + 31.101444244384766 1639 @@ -18,9 +18,9 @@ 1 - True - True - True - True + False + False + False + False \ No newline at end of file diff --git a/rp_lib.py b/rp_lib.py index 5eaf332..28e0084 100644 --- a/rp_lib.py +++ b/rp_lib.py @@ -166,7 +166,7 @@ def sound_play (sound): audiodev.play(sound) ############################################################################### -# Rover fonction élèves +# Rover fonctions élève ############################################################################### ## @@ -636,7 +636,7 @@ def rp_radar (): # FIXME ############################################################################### -# Rover fonction avancées (upgrade) élèves +# Rover fonctions avancées (upgrade) élève ############################################################################### ## @@ -777,6 +777,88 @@ def rp_batterie (): print ("Charge de la batterie :", scene.objects['Points']['battery']) return scene.objects['Points']['battery'] +############################################################################### +# Rover fonctions de script +############################################################################### + +## +# Retourne la visibilité de la grille +## + +def rp_grid (): + if debug: + print ("Visibilité de la grille :", scene.objects['Grid-u'].visible) + return scene.objects['Grid-u'].visible + +## +# Affiche/cache l'objectif et retour la visibilité +## + +def rp_set_grid (visibility=False): + + # Affiche la grille + if visibility and scene.objects['Grid-u'].visible == False: + scene.objects['Grid-u']['timer'] = 0 + bpy.data.materials["Grid"].node_tree.nodes["Shader de mélange"].inputs[0].default_value = 0 + bpy.data.materials["Grid-Yellow"].node_tree.nodes["Shader de mélange"].inputs[0].default_value = 0 + bpy.data.materials["Grid-Green"].node_tree.nodes["Shader de mélange"].inputs[0].default_value = 0 + bpy.data.materials["Grid-Holo"].node_tree.nodes["Émission"].inputs[1].default_value = 0 + bpy.data.materials["Grid-Holo-Yellow"].node_tree.nodes["Émission.003"].inputs[1].default_value = 0 + bpy.data.materials["Grid-Holo-Green"].node_tree.nodes["Émission"].inputs[1].default_value = 0 + scene.objects['Grid-u'].setVisible(True,True) + scene.objects['Grid-v'].setVisible(True,True) + rp_map.aim_show() + scene.objects['Grid-u']['anim'] = True + + # Cache la grille + if visibility==False and scene.objects['Grid-u'].visible: + scene.objects['Grid-u'].setVisible(False,True) + scene.objects['Grid-v'].setVisible(False,True) + rp_map.aim_hide() + +## +# Retourne le numéro de la mission en cours +## + +def rp_level (): + return scene.objects['Points']['mission'] + +## +# Sélectionner la mission +## + +def rp_set_level (mission): + if mission != scene.objects['Points']['mission']: + scene.objects['Points']['mission'] = mission + terrain_stop () + rp_map.task() + if scene.objects['Grid-u'].visible: + rp_map.aim_show() + scene.objects['Points']['mission_init'] = scene.objects['Points']['mission'] + +## +# Retourne la liste des upgrades actifs +## + +def rp_upgrade (): + upgrade_card=("battery", "beacon", "paint", "speed") + upgrades_selected=[] + for i in range(len(upgrade_card)): + if scene.objects['Points']["upgrade_"+upgrade_card[i]]: + upgrades_selected.append(upgrade_card[i]) + return upgrades_selected + +## +# Sélectionner une amélioration +## + +def rp_set_upgrade (upgrade, activation=True): + upgrade_card=("battery", "beacon", "paint", "speed") + for i in range(len(upgrade_card)): + if upgrade == upgrade_card[i]: + scene.objects['Points']["upgrade_"+upgrade_card[i]]=activation + break + ############################################################################### # Colision ############################################################################### diff --git a/rp_store.py b/rp_store.py index 6644156..0462343 100644 --- a/rp_store.py +++ b/rp_store.py @@ -79,6 +79,7 @@ def open2 (cont): obj.worldPosition.z = 0.19 # Overlay + # FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra scene.objects['Terrain']['manip_mode']=8 # Fenêtre modale type Doc scene.removeOverlayCollection(bpy.data.collections['Hud']) scene.objects['Points'].setVisible(False,True) @@ -86,11 +87,19 @@ def open2 (cont): scene.active_camera = scene.objects["Camera-Store"] scene.objects['Camera'].setVisible(False,True) + # Calcul du crédit disponible + upgrade_nb = 0 + upgrade_card=("battery", "beacon", "paint", "speed") + for i in range(len(upgrade_card)): + if scene.objects['Points']["upgrade_"+upgrade_card[i]]: + upgrade_nb +=1 + upgrade_credit = scene.objects['Points']['level']- 1 - upgrade_nb # Le level 1 n'apporte pas de crédit + # Animation de la bulle scene.objects['Bubble-1-text']['Text']="Salut mon ami !\n Souhaites tu\n acquerir des\n nouvelles\n améliorations ?\n" - if scene.objects['Points']['upgrade_nb'] == 4 : + if upgrade_nb == 4 : scene.objects['Bubble-1-text']['Text']="Resalut ! \n Rien de neuf \n pour le moment. \n Il fait beau \n aujourd'hui, non ?" - if scene.objects['Points']['upgrade_nb'] < 4 and scene.objects['Points']['upgrade_credit']==0: + if upgrade_nb < 4 and upgrade_credit ==0: scene.objects['Bubble-1-text']['Text']="Des missions \n tu passeras, \n des crédits \n tu auras !" start = 1 @@ -115,7 +124,9 @@ def open2 (cont): scene.objects['Store_upgrade-colbox'].suspendPhysics (True) upgrade_card=("battery", "beacon", "paint", "speed") for i in range(len(upgrade_card)): - if scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] == True: + if scene.objects['Points']["upgrade_"+upgrade_card[i]]: + scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True + # if scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] == True: scene.objects["Store-"+upgrade_card[i]+"-card"].color = color_store_upgraded scene.objects["Store-"+upgrade_card[i]+"-card-icon"].color = color_store_upgraded scene.objects["Store-"+upgrade_card[i]+"-card-text"].color = color_store_upgraded @@ -125,7 +136,7 @@ def open2 (cont): scene.objects["Store-"+upgrade_card[i]+"-card-text"].color = color_store_fct scene.objects['Store-panel']['page_fct'] ="" scene.objects['Store_text']['Text'] = " " - scene.objects['Store_credits']['Text'] = "Crédits : "+str(scene.objects['Points']['upgrade_credit']) + scene.objects['Store_credits']['Text'] = "Crédits : "+str(upgrade_credit) # Animation de la tablette scene.objects['Store-panel'].setVisible(True,True) @@ -253,8 +264,16 @@ def card (cont): scene.objects['Store_text']['Text'] = rp_doc.upgrade_description(name_fct) scene.objects['Store_text'].setVisible(True, False) + # Calcul du crédit disponible + upgrade_nb = 0 + upgrade_card=("battery", "beacon", "paint", "speed") + for i in range(len(upgrade_card)): + if scene.objects['Points']["upgrade_"+upgrade_card[i]]: + upgrade_nb +=1 + upgrade_credit = scene.objects['Points']['level']- 1 - upgrade_nb # Le level 1 n'apporte pas de crédit + # Upgrade - if scene.objects[name_fct]['upgraded'] == True or scene.objects['Points']['upgrade_credit'] ==0: + if scene.objects[name_fct]['upgraded'] == True or upgrade_credit <=0: scene.objects['Store_upgrade'].setVisible(False, False) scene.objects['Store_upgrade-colbox'].suspendPhysics (True) else: @@ -262,7 +281,7 @@ def card (cont): scene.objects['Store_upgrade-colbox']. restorePhysics() ## -# Selectionner l'upgrade +# Sélectionner l'upgrade ## def upgrade (cont): @@ -271,17 +290,35 @@ def upgrade (cont): obj = cont.owner name_fct = scene.objects['Store-panel']['page_fct'] if name_fct !="": + + # Cartes scene.objects[name_fct]['upgraded'] = True scene.objects[scene.objects['Store-panel']['page_fct']].color = color_store_upgraded scene.objects[scene.objects['Store-panel']['page_fct']+'-text'].color = color_store_upgraded scene.objects[scene.objects['Store-panel']['page_fct']+'-icon'].color = color_store_upgraded - scene.objects['Points']['upgrade_nb'] +=1 - scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb'] - scene.objects['Store_credits']['Text'] = "Crédits : "+str(scene.objects['Points']['upgrade_credit']) + # scene.objects['Points']['upgrade_nb'] +=1 + # scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb'] + # scene.objects['Store_credits']['Text'] = "Crédits : "+str(scene.objects['Points']['upgrade_credit']) scene.objects['Store_upgrade'].setVisible(False, False) scene.objects['Store_upgrade'].suspendPhysics (True) scene.objects['Bubble-1-text']['Text']=rp_doc.upgrade_talk(name_fct) + # Mise à jour des améliorations + upgrade_card=("battery", "beacon", "paint", "speed") + for i in range(len(upgrade_card)): + if scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] == True: + scene.objects['Points']["upgrade_"+upgrade_card[i]]=True + break + + # Calcul du crédit disponible + upgrade_nb = 0 + upgrade_card=("battery", "beacon", "paint", "speed") + for i in range(len(upgrade_card)): + if scene.objects['Points']["upgrade_"+upgrade_card[i]]: + upgrade_nb +=1 + upgrade_credit = scene.objects['Points']['level']- 1 - upgrade_nb # Le level 1 n'apporte pas de crédit + scene.objects['Store_credits']['Text'] = "Crédits : "+str(upgrade_nb) + ############################################################################### # Rover ###############################################################################