mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Mise en place des instructions de scriptage
This commit is contained in:
parent
904edc6004
commit
3bb4b9da48
BIN
ropy-34.blend
BIN
ropy-34.blend
Binary file not shown.
BIN
ropy-35.blend
Normal file
BIN
ropy-35.blend
Normal file
Binary file not shown.
26
rp.py
26
rp.py
@ -135,6 +135,7 @@ def terrain_init (cont):
|
|||||||
# Ajout du Hud
|
# Ajout du Hud
|
||||||
scene.active_camera = scene.objects["Camera"]
|
scene.active_camera = scene.objects["Camera"]
|
||||||
scene.objects['Sun'].setVisible(True,True)
|
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'])
|
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||||
|
|
||||||
# Mémorisation des positions par défaut
|
# Mémorisation des positions par défaut
|
||||||
@ -508,13 +509,13 @@ def cmd_init(cont):
|
|||||||
# Upgrade
|
# Upgrade
|
||||||
# Read config (upgrades choisis : data/upgrade/ -> [2][i].text)
|
# Read config (upgrades choisis : data/upgrade/ -> [2][i].text)
|
||||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
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)):
|
for i in range(len(upgrade_card)):
|
||||||
if rp_config_tree[2][i].text == "True":
|
if rp_config_tree[2][i].text == "True":
|
||||||
scene.objects['Points']['upgrade_'+upgrade_card[i]]=True
|
scene.objects['Points']['upgrade_'+upgrade_card[i]]=True
|
||||||
scene.objects['Points']['upgrade_nb'] +=1
|
# scene.objects['Points']['upgrade_nb'] +=1
|
||||||
scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True
|
# 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_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb']
|
||||||
upgrade_maj()
|
upgrade_maj()
|
||||||
|
|
||||||
# Speed
|
# Speed
|
||||||
@ -1079,6 +1080,7 @@ def tablet_open ():
|
|||||||
scene.objects['Cmd-text']['Text']= ""
|
scene.objects['Cmd-text']['Text']= ""
|
||||||
|
|
||||||
# Overlay
|
# Overlay
|
||||||
|
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||||
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
||||||
scene.objects['Points'].setVisible(False,True)
|
scene.objects['Points'].setVisible(False,True)
|
||||||
scene.objects['Commands'].setVisible(False,True)
|
scene.objects['Commands'].setVisible(False,True)
|
||||||
@ -1112,6 +1114,7 @@ def tablet_close ():
|
|||||||
scene.objects['Commands'].setVisible(True,True)
|
scene.objects['Commands'].setVisible(True,True)
|
||||||
scene.objects['Camera'].setVisible(True,True)
|
scene.objects['Camera'].setVisible(True,True)
|
||||||
scene.active_camera = scene.objects["Camera"]
|
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'])
|
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||||
|
|
||||||
# UI : Commands
|
# UI : Commands
|
||||||
@ -1330,11 +1333,9 @@ def store_close():
|
|||||||
# Maj du fichier de config (upgrade : data/upgrade/i -> [2][i].text)
|
# Maj du fichier de config (upgrade : data/upgrade/i -> [2][i].text)
|
||||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
upgrade_card=("battery", "beacon", "paint", "speed")
|
||||||
for i in range(len(upgrade_card)):
|
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['Points']["upgrade_"+upgrade_card[i]]=True
|
|
||||||
rp_config_tree[2][i].text="True"
|
rp_config_tree[2][i].text="True"
|
||||||
else:
|
else:
|
||||||
scene.objects['Points']["upgrade_"+upgrade_card[i]]=False
|
|
||||||
rp_config_tree[2][i].text="False"
|
rp_config_tree[2][i].text="False"
|
||||||
config_save()
|
config_save()
|
||||||
|
|
||||||
@ -1349,6 +1350,7 @@ def store_close():
|
|||||||
scene.objects['Commands'].setVisible(True,True)
|
scene.objects['Commands'].setVisible(True,True)
|
||||||
scene.objects['Camera'].setVisible(True,True)
|
scene.objects['Camera'].setVisible(True,True)
|
||||||
scene.active_camera = scene.objects["Camera"]
|
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'])
|
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||||
|
|
||||||
# UI : Commands
|
# UI : Commands
|
||||||
@ -1521,16 +1523,16 @@ def config_load():
|
|||||||
|
|
||||||
# Upgrade
|
# Upgrade
|
||||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
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)):
|
for i in range(len(upgrade_card)):
|
||||||
if rp_config_tree[2][i].text == "True":
|
if rp_config_tree[2][i].text == "True":
|
||||||
scene.objects['Points']['upgrade_'+upgrade_card[i]]=True
|
scene.objects['Points']['upgrade_'+upgrade_card[i]]=True
|
||||||
scene.objects['Points']['upgrade_nb'] +=1
|
# scene.objects['Points']['upgrade_nb'] +=1
|
||||||
scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True
|
# scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True
|
||||||
else:
|
else:
|
||||||
scene.objects['Points']['upgrade_'+upgrade_card[i]]=False
|
scene.objects['Points']['upgrade_'+upgrade_card[i]]=False
|
||||||
scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = 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['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb']
|
||||||
upgrade_maj()
|
upgrade_maj()
|
||||||
|
|
||||||
# Speed
|
# Speed
|
||||||
|
@ -192,6 +192,7 @@ def credits(cont):
|
|||||||
scene.objects["Credits"]['init_lz']=scene.objects["Credits"].worldPosition.z
|
scene.objects["Credits"]['init_lz']=scene.objects["Credits"].worldPosition.z
|
||||||
|
|
||||||
# Overlay
|
# Overlay
|
||||||
|
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||||
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
||||||
scene.objects['Points'].setVisible(False,True)
|
scene.objects['Points'].setVisible(False,True)
|
||||||
scene.objects['Commands'].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['Commands'].setVisible(True,True)
|
||||||
scene.objects['Camera'].setVisible(True,True)
|
scene.objects['Camera'].setVisible(True,True)
|
||||||
scene.active_camera = scene.objects["Camera"]
|
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'])
|
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||||
|
|
||||||
# UI : Commands
|
# UI : Commands
|
||||||
|
35
rp_cmd.py
35
rp_cmd.py
@ -25,35 +25,16 @@ from rp_lib import * # Bibliothèque Ropy
|
|||||||
# Commandes
|
# Commandes
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
def mrp_avancer():
|
|
||||||
pass
|
|
||||||
|
|
||||||
def commandes():
|
def commandes():
|
||||||
|
|
||||||
print ('Go go go ...')
|
rp_gauche()
|
||||||
|
for i in range (2):
|
||||||
mrp_avancer()
|
rp_avancer()
|
||||||
mrp_avancer()
|
rp_marquer()
|
||||||
mrp_avancer()
|
rp_droite()
|
||||||
|
for i in range (4):
|
||||||
while True:
|
rp_avancer()
|
||||||
rp_droite()
|
rp_marquer()
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# En: External call << DONT CHANGE THIS SECTION >>
|
# En: External call << DONT CHANGE THIS SECTION >>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<data>
|
<data>
|
||||||
<config>
|
<config>
|
||||||
<speed>4.0</speed>
|
<speed>1.0</speed>
|
||||||
<sound>False</sound>
|
<sound>False</sound>
|
||||||
<cam>
|
<cam>
|
||||||
<worldPosition.x>2.3307816982269287</worldPosition.x>
|
<worldPosition.x>0.0057830810546875</worldPosition.x>
|
||||||
<worldPosition.y>-43.80031204223633</worldPosition.y>
|
<worldPosition.y>-39.4045524597168</worldPosition.y>
|
||||||
<worldPosition.z>36.77288055419922</worldPosition.z>
|
<worldPosition.z>31.101444244384766</worldPosition.z>
|
||||||
</cam>
|
</cam>
|
||||||
<screen>
|
<screen>
|
||||||
<width>1639</width>
|
<width>1639</width>
|
||||||
@ -18,9 +18,9 @@
|
|||||||
<level>1</level>
|
<level>1</level>
|
||||||
</mission>
|
</mission>
|
||||||
<upgrade>
|
<upgrade>
|
||||||
<battery>True</battery>
|
<battery>False</battery>
|
||||||
<beacon>True</beacon>
|
<beacon>False</beacon>
|
||||||
<paint>True</paint>
|
<paint>False</paint>
|
||||||
<speed>True</speed>
|
<speed>False</speed>
|
||||||
</upgrade>
|
</upgrade>
|
||||||
</data>
|
</data>
|
86
rp_lib.py
86
rp_lib.py
@ -166,7 +166,7 @@ def sound_play (sound):
|
|||||||
audiodev.play(sound)
|
audiodev.play(sound)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Rover fonction élèves
|
# Rover fonctions élève
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -636,7 +636,7 @@ def rp_radar ():
|
|||||||
# FIXME
|
# 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'])
|
print ("Charge de la batterie :", scene.objects['Points']['battery'])
|
||||||
return 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
|
# Colision
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
55
rp_store.py
55
rp_store.py
@ -79,6 +79,7 @@ def open2 (cont):
|
|||||||
obj.worldPosition.z = 0.19
|
obj.worldPosition.z = 0.19
|
||||||
|
|
||||||
# Overlay
|
# 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.objects['Terrain']['manip_mode']=8 # Fenêtre modale type Doc
|
||||||
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
||||||
scene.objects['Points'].setVisible(False,True)
|
scene.objects['Points'].setVisible(False,True)
|
||||||
@ -86,11 +87,19 @@ def open2 (cont):
|
|||||||
scene.active_camera = scene.objects["Camera-Store"]
|
scene.active_camera = scene.objects["Camera-Store"]
|
||||||
scene.objects['Camera'].setVisible(False,True)
|
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
|
# 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"
|
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 ?"
|
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 !"
|
scene.objects['Bubble-1-text']['Text']="Des missions \n tu passeras, \n des crédits \n tu auras !"
|
||||||
|
|
||||||
start = 1
|
start = 1
|
||||||
@ -115,7 +124,9 @@ def open2 (cont):
|
|||||||
scene.objects['Store_upgrade-colbox'].suspendPhysics (True)
|
scene.objects['Store_upgrade-colbox'].suspendPhysics (True)
|
||||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
upgrade_card=("battery", "beacon", "paint", "speed")
|
||||||
for i in range(len(upgrade_card)):
|
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"].color = color_store_upgraded
|
||||||
scene.objects["Store-"+upgrade_card[i]+"-card-icon"].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
|
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-"+upgrade_card[i]+"-card-text"].color = color_store_fct
|
||||||
scene.objects['Store-panel']['page_fct'] =""
|
scene.objects['Store-panel']['page_fct'] =""
|
||||||
scene.objects['Store_text']['Text'] = " "
|
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
|
# Animation de la tablette
|
||||||
scene.objects['Store-panel'].setVisible(True,True)
|
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']['Text'] = rp_doc.upgrade_description(name_fct)
|
||||||
scene.objects['Store_text'].setVisible(True, False)
|
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
|
# 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'].setVisible(False, False)
|
||||||
scene.objects['Store_upgrade-colbox'].suspendPhysics (True)
|
scene.objects['Store_upgrade-colbox'].suspendPhysics (True)
|
||||||
else:
|
else:
|
||||||
@ -262,7 +281,7 @@ def card (cont):
|
|||||||
scene.objects['Store_upgrade-colbox']. restorePhysics()
|
scene.objects['Store_upgrade-colbox']. restorePhysics()
|
||||||
|
|
||||||
##
|
##
|
||||||
# Selectionner l'upgrade
|
# Sélectionner l'upgrade
|
||||||
##
|
##
|
||||||
|
|
||||||
def upgrade (cont):
|
def upgrade (cont):
|
||||||
@ -271,17 +290,35 @@ def upgrade (cont):
|
|||||||
obj = cont.owner
|
obj = cont.owner
|
||||||
name_fct = scene.objects['Store-panel']['page_fct']
|
name_fct = scene.objects['Store-panel']['page_fct']
|
||||||
if name_fct !="":
|
if name_fct !="":
|
||||||
|
|
||||||
|
# Cartes
|
||||||
scene.objects[name_fct]['upgraded'] = True
|
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']].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']+'-text'].color = color_store_upgraded
|
||||||
scene.objects[scene.objects['Store-panel']['page_fct']+'-icon'].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_nb'] +=1
|
||||||
scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb']
|
# 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_credits']['Text'] = "Crédits : "+str(scene.objects['Points']['upgrade_credit'])
|
||||||
scene.objects['Store_upgrade'].setVisible(False, False)
|
scene.objects['Store_upgrade'].setVisible(False, False)
|
||||||
scene.objects['Store_upgrade'].suspendPhysics (True)
|
scene.objects['Store_upgrade'].suspendPhysics (True)
|
||||||
scene.objects['Bubble-1-text']['Text']=rp_doc.upgrade_talk(name_fct)
|
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
|
# Rover
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user