Ajout de l'animation du forage

This commit is contained in:
Philippe Roy 2022-10-08 11:35:45 +02:00
parent c38ceb9e9f
commit af2095b0c8
21 changed files with 648348 additions and 64 deletions

1282
asset/rover/ropy-arm.dae Executable file

File diff suppressed because one or more lines are too long

638871
asset/rover/ropy-arm.obj Executable file

File diff suppressed because it is too large Load Diff

7963
asset/rover/ropy-arm.step Executable file

File diff suppressed because it is too large Load Diff

BIN
asset/rover/rover_arm.blend Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ropy-27.blend Normal file

Binary file not shown.

5
rp.py
View File

@ -121,7 +121,7 @@ def points_maj (cont):
# Position du Rover
obj=scene.objects['Rover']
obj['position']=str(round(obj.worldPosition.x,3))+","+str(round(obj.worldPosition.y,3))+","+str(round(obj.worldPosition.z,3))
obj['w_position']=str(round(obj.worldPosition.x,3))+","+str(round(obj.worldPosition.y,3))+","+str(round(obj.worldPosition.z,3))
###############################################################################
# Terrain
@ -178,7 +178,6 @@ def terrain_init ():
applyRotationTo(drill_aim, 40*2*math.pi*(1/360), 0, 0, False)
drill_aim.name="Drill_aim-"+str(i)
drill_aim.setVisible(False,True)
drill_aim['activated']=False
drill_tile= scene.addObject("Drill_tile", scene.objects['Terrain'])
drill_tile.name="Drill_tile-"+str(i)
drill_tile.setVisible(False,True)
@ -319,7 +318,7 @@ def terrain_grid_anim ():
bpy.data.materials["Grid-Holo"].node_tree.nodes["Émission"].inputs[1].default_value =scene.objects['Grid-u']['timer']*5
bpy.data.materials["Grid-Holo-Yellow"].node_tree.nodes["Émission.003"].inputs[1].default_value =scene.objects['Grid-u']['timer']*5
bpy.data.materials["Grid-Holo-Green"].node_tree.nodes["Émission"].inputs[1].default_value =scene.objects['Grid-u']['timer']*5
scene.objects['Grid-u']['timer']+=0.01
scene.objects['Grid-u']['timer']+=0.05
if scene.objects['Grid-u']['timer']>= 1:
scene.objects['Grid-u']['anim'] = False

View File

@ -54,14 +54,25 @@ def mrp_avancer_mur_sb(): # sb = sans balise
def commandes():
# Mission 6
rp_gauche()
mrp_avancer_mur_sb()
rp_droite()
mrp_avancer_mur_sb()
rp_gauche()
rp_reculer()
rp_reculer()
rp_reculer()
rp_reculer()
rp_reculer()
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()
###############################################################################

View File

@ -1,16 +1,16 @@
<data>
<config>
<speed>0.25</speed>
<speed>1.0</speed>
<sound>False</sound>
<cam>
<worldPosition.x>-12.146218299865723</worldPosition.x>
<worldPosition.y>-3.286367416381836</worldPosition.y>
<worldPosition.z>5.455016613006592</worldPosition.z>
<worldPosition.x>11.022780418395996</worldPosition.x>
<worldPosition.y>-29.51092529296875</worldPosition.y>
<worldPosition.z>32.129486083984375</worldPosition.z>
</cam>
</config>
<mission>
<current>3</current>
<level>6</level>
<current>6</current>
<level>7</level>
</mission>
<upgrade>
<battery>True</battery>

View File

@ -36,7 +36,7 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE
card_description ={}
# Missions
card_description.update(rp_map1.get_card_description())
card_description.update(rp_map1.get_missions_description())
missions_card=rp_map1.get_missions_card()
################################################################################
@ -46,8 +46,8 @@ missions_card=rp_map1.get_missions_card()
rover_card=["forward-card", "turn-card", "delineate-card", "detect-card", "radar-card"]
rover_card=rover_card+["speed-card", "paint-card", "battery-card", "beacon-card"]
# Avancer
rp_forward_title="Avancer"
# Avancer et reculer
rp_forward_title="Avancer et reculer"
rp_forward_text=" rp_avancer() \n -> Avance d'un pas en avant. \n\n"
rp_forward_text=rp_forward_text + " rp_reculer() \n -> Recule d'un pas."
rp_forward_type="standard"
@ -76,16 +76,21 @@ card_description.update({"detect-card" : [rp_detect_title, rp_detect_text, rp_de
# Radar
rp_radar_title="Radar"
rp_radar_text=" Le radar n'est toujours pas \n opérationnel ! \n\n Mais où est donc encore passé Thomas ! \n\n\n\n\n\n\n\n"
rp_radar_type="standard"
rp_radar_type="mission"
card_description.update({"radar-card" : [rp_radar_title, rp_radar_text, rp_radar_type]})
# Cards description pour le magasin
storecard_description ={}
# Speed - Vitesse
rp_speed_title="Vitesse"
rp_speed_text=" L'amélioration \"Vitesse\" permet de \n changer la vitesse des déplacements \n par l'interface (en bas à gauche).\n\n"
rp_speed_text=rp_speed_text + " La vitesse est modifiable par codage : \n"
rp_speed_text=rp_speed_text + " rp_vitesse(nouvelle_vitesse), où \n la vitesse est une valeur de 0,1 à 10.\n\n La fonction rp_vitesse() retourne la \n vitesse actuelle. \n\n\n"
rp_speed_store="Permet de modifier\nla vitesse des \ndéplacements."
rp_speed_purchased="Je vois ... \n l'efficacité, hein ! \n Vous verrez avec \n ces moteurs,\n c'est autre vie."
rp_speed_type="upgrade"
card_description.update({"speed-card" : [rp_speed_title, rp_speed_text, rp_speed_type]})
card_description.update({"speed-card" : [rp_speed_title, rp_speed_text, rp_speed_store, rp_speed_purchased, rp_speed_type]})
# Paint - Peinture
rp_paint_title="Peinture"
@ -94,28 +99,35 @@ rp_paint_text=" rp_couleur(objets, couleur) \n -> Change la couleur du groupe \n
rp_paint_text=rp_paint_text + " - La couleur est un tuple au format \n (R,V,B,Alpha) avec des valeurs de 0 à 1.\n"
rp_paint_text=rp_paint_text + " - objets peut être : \"Rover 1\",\n \"Rover 2\", \"Rover 3\", \"Station 1\", \n \"Station 2\", \"Station 3\", \"Station 4\", \n \"Balises\" ou \"Balise 1\" à \"Balise 200\".\n\n"
rp_paint_text=rp_paint_text + " rp_couleur_init(objets) \n -> Réinitialise la couleur des objets.\n rp_couleur_init() réinitialise tout !\n"
rp_paint_store="On refait la déco ?"
rp_paint_purchased="Rien de tel qu'un \n peu de couleur \n dans ce monde \n de brute !"
rp_paint_type="upgrade"
card_description.update({"paint-card" : [rp_paint_title, rp_paint_text, rp_paint_type]})
card_description.update({"paint-card" : [rp_paint_title, rp_paint_text, rp_paint_store, rp_paint_purchased, rp_paint_type]})
# Battery + - Batterie +
rp_battery_title="Batterie +"
rp_battery_text=" L'amélioration \"Batterie +\" permet \n d'augmenter la capacité de la batterie \n du Rover à 200 pas (contre 20 pas). \n\n"
rp_battery_text=rp_battery_text + " La fonction rp_batterie() retourne \n la charge actuelle de la batterie \n (valeur de 0 à 100 %).\n\n\n\n\n\n\n"
rp_battery_store="Augmente la capacité \nde la batterie à 200 \nmouvements (contre \n20, plutôt faible ...)."
rp_battery_purchased="Très bon choix ! \n Cette batterie \n vous va comme \n un gant."
rp_battery_type="upgrade"
card_description.update({"battery-card" : [rp_battery_title, rp_battery_text, rp_battery_type]})
card_description.update({"battery-card" : [rp_battery_title, rp_battery_text, rp_battery_store, rp_battery_purchased, rp_battery_type]})
# Beacon + - Balise +
rp_beacon_title="Balise +"
rp_beacon_text=" L'amélioration \"Balise +\" permet \n d'augmenter le nombre de balises \n pouvant être posées à 200 (contre 20). \n\n"
rp_beacon_text=rp_beacon_text + " La fonction rp_balise() retourne \n le nombre de balises posées lors du \n trajet. \n\n\n\n\n\n\n\n"
rp_beacon_text=rp_beacon_text + " La fonction rp_balise() retourne \n le nombre de balises dejà posées \n lors du trajet. \n\n\n\n\n\n\n\n"
rp_beacon_store="Porte le nombre de \nbalises transportées\nà 200 (contre 20)."
rp_beacon_purchased="Les colis viennent \n tout juste d'être \n livrés. Ce terrain\n va devenir un vrai \n sapin de Noël !"
rp_beacon_type="upgrade"
card_description.update({"beacon-card" : [rp_beacon_title, rp_beacon_text, rp_beacon_type]})
card_description.update({"beacon-card" : [rp_beacon_title, rp_beacon_text, rp_beacon_store, rp_beacon_purchased, rp_beacon_type]})
###############################################################################
# Documentation Python
###############################################################################
python_card=["function-card", "alternative-card", "loop-card", "flow-card", "text-card", "list-card", "dict-card", "oop-card", "console-card", "sleep-card"]
# python_card=["function-card", "alternative-card", "loop-card", "flow-card", "text-card", "list-card", "dict-card", "oop-card", "console-card", "sleep-card"]
python_card=["function-card", "alternative-card", "loop-card", "flow-card", "console-card", "sleep-card"]
# Fonction
rp_function_title="Fonction"
@ -571,6 +583,24 @@ def python_link (cont):
print (i)
webbrowser.open(card_description[name_fct][2][int(i)][1])
##
# Texte pour le store
##
def upgrade_description (card):
name_fct =card[6:]
if name_fct in card_description:
return card_description[name_fct][2]
else:
return ""
def upgrade_talk (card):
name_fct =card[6:]
if name_fct in card_description:
return card_description[name_fct][3]
else:
return ""
##
# Sounds
##

144
rp_lib.py
View File

@ -609,17 +609,18 @@ color_metal = (0.401, 0.478, 0.518, 1)
paint_part ={}
all_group_part = ("Rover 1", "Rover 2", "Rover 3", "Station 1", "Station 2", "Station 3", "Station 4", "Station cube 1", "Station cube 2", "Stone", "Metal", "Black", "Red windows")
paint_part.update({"Stone" : [['Rv-Wheel-left-front', 'Rv-Wheel-right-front','Rv-Wheel-left-mid', 'Rv-Wheel-right-mid', 'Rv-Wheel-left-rear', 'Rv-Wheel-right-rear'],color_stone]}) # Stone
paint_part.update({"Metal" : [['Rv-Power source', 'Rv-Mast-arm', 'Rv-Antenna-1', 'St-Sheath'],color_metal]}) # Metal
paint_part.update({"Metal" : [['Rv-Power source', 'Rv-Mast-arm', 'Rv-Antenna-1', 'St-Sheath', 'Rv-Arm-Segment-1', 'Rv-Arm-Segment-2'],color_metal]}) # Metal
paint_part.update({"Black" : [['St-Block1-foot1','St-Block1-foot2','St-Block1-foot3', 'St-Door-2', 'St-Stair-2','St-Cable1','St-Cable2'],color_black]}) # Black
paint_part.update({"Red windows" : [['St-Block1-window','St-Block2-window'],color_windows_red]}) # Red windows
# Rover
rover_partlist =['Rover (Rv-Body-1)', 'Rv-Body-2', 'Rv-Body-3', 'Rv-Body-4', 'Rv-Body-5', 'Rv-Body-6', 'Rv-Body-7',
'Rv-Mast', 'Rv-Mast-2', 'Rv-Mast-3', 'Rv-Mast-4', 'Rv-Mast-cap', 'Rv-Mast-arm','Rv-Antenna-1','Rv-Antenna-2','Rv-Antenna-3',
'Rv-Arm-Head', 'Rv-Arm-Segment-1', 'Rv-Arm-Segment-2',
'Rv-Power source', 'Rv-Power source-2', 'Rv-Power source-3', 'Rv-Power source-4', 'Rv-Power source-5',
'Rv-Wheel-left-front', 'Rv-Wheel-right-front','Rv-Wheel-left-mid', 'Rv-Wheel-right-mid', 'Rv-Wheel-left-rear', 'Rv-Wheel-right-rear']
paint_part.update({"Rover 1" : [['Rv-Body-2', 'Rv-Body-7', 'Rv-Power source-2', 'Rv-Power source-5', 'Rv-Mast-3', 'Rv-Mast-4', 'Rv-Mast-cap', 'Rv-Antenna-2'],color_yellow]}) # Jaune
paint_part.update({"Rover 2" : [['Rover', 'Rv-Body-6', 'Rv-Mast', 'Rv-Antenna-3'],color_white]}) # Blanc
paint_part.update({"Rover 2" : [['Rover', 'Rv-Body-6', 'Rv-Mast', 'Rv-Antenna-3', 'Rv-Arm-Head'],color_white]}) # Blanc
paint_part.update({"Rover 3" : [['Rv-Body-3', 'Rv-Body-4', 'Rv-Power source-3', 'Rv-Power source-4','Rv-Mast-2'],color_wooddark]}) # WoodDark
# Station
@ -846,6 +847,10 @@ def rover_colision_station (back):
# Goal
###############################################################################
##
# Fin de mission
##
def rover_goal ():
obj=scene.objects['Rover']
if (debug_mvt):
@ -889,13 +894,142 @@ def rover_goal ():
y0 = obj.worldPosition.y
obj.worldPosition.x = round(x0)
obj.worldPosition.y = round(y0)
# print ("Position actuelle :", x0, y0, obj.worldPosition.x, obj.worldPosition.y)
# Level
# print ("scene.objects['Points']['mission'] :", scene.objects['Points']['mission'])
# print ("scene.objects['Points']['level'] :", scene.objects['Points']['level'])
if scene.objects['Points']['mission']==scene.objects['Points']['level']:
scene.objects['Points']['level']+=1
##
# Forage
##
def rover_drill (x,y):
obj=scene.objects['Rover']
if (debug_mvt):
print ("Goal : ", [x,y])
# Animation
if scene.objects['Commands']['speed'] < 10:
# Recul d'une 1/2 case
start = 1
end = 50
layer = 0
priority = 1
blendin = 1.0
mode = bge.logic.KX_ACTION_MODE_PLAY
layerWeight = 0.0
ipoFlags = 0
speed = scene.objects['Commands']['speed']*8
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
obj.playAction('Rover-Avancer-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
obj.playAction('Rover-Avancer-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
obj.playAction('Rover-Avancer-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
obj.playAction('Rover-Avancer-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
while scene.objects['Rv-Wheel-right-front'].isPlayingAction(): # Forçage du redraw
scene.objects['Sun'].applyMovement((0, 0, 0), True)
rp_tempo (0.1)
# Forage
start = 1
end = 300
layer = 0
priority = 1
blendin = 1.0
mode = bge.logic.KX_ACTION_MODE_PLAY
layerWeight = 0.0
ipoFlags = 0
speed = scene.objects['Commands']['speed']*8
scene.objects['Rv-Arm-Joint-1'].playAction('Arm-Joint-1-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Segment-1'].playAction('Arm-Segment-1-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Segment-2'].playAction('Arm-Segment-2-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Joint-2'].playAction('Arm-Joint-2-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Head'].playAction('Arm-Head-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
while scene.objects['Rv-Arm-Joint-1'].isPlayingAction(): # Forçage du redraw
scene.objects['Sun'].applyMovement((0, 0, 0), True)
rp_tempo (0.1)
# Tuile
for i in range (10):
if scene.objects['Drill_tile-'+str(i)].visible==False:
scene.objects['Drill_tile-'+str(i)].worldPosition.x = x
scene.objects['Drill_tile-'+str(i)].worldPosition.y = y
scene.objects['Drill_tile-'+str(i)].setVisible(True,True)
break
for obj_i in scene.objects:
if "tile_dirtHigh" in obj_i.name:
if round(obj_i.worldPosition.x) == x and round(obj_i.worldPosition.y) == y :
obj_i.setVisible(False, True)
if scene.objects['Commands']['speed'] < 10:
# Fin de forage
start = 300
end = 600
layer = 0
priority = 1
blendin = 1.0
mode = bge.logic.KX_ACTION_MODE_PLAY
layerWeight = 0.0
ipoFlags = 0
speed = scene.objects['Commands']['speed']*8
scene.objects['Rv-Arm-Joint-1'].playAction('Arm-Joint-1-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Segment-1'].playAction('Arm-Segment-1-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Segment-2'].playAction('Arm-Segment-2-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Joint-2'].playAction('Arm-Joint-2-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Arm-Head'].playAction('Arm-Head-Drill', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
while scene.objects['Rv-Arm-Joint-1'].isPlayingAction(): # Forçage du redraw
scene.objects['Sun'].applyMovement((0, 0, 0), True)
rp_tempo (0.1)
# Avance d'une 1/2 case
start = 1
end = 50
layer = 0
priority = 1
blendin = 1.0
mode = bge.logic.KX_ACTION_MODE_PLAY
layerWeight = 0.0
ipoFlags = 0
speed = scene.objects['Commands']['speed']*8
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
obj.playAction('Rover-Avancer-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
obj.playAction('Rover-Avancer-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
obj.playAction('Rover-Avancer-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
obj.playAction('Rover-Avancer-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
while scene.objects['Rv-Wheel-right-front'].isPlayingAction(): # Forçage du redraw
scene.objects['Sun'].applyMovement((0, 0, 0), True)
rp_tempo (0.1)
# # Tuile
# for i in range (10):
# if scene.objects['Drill_tile-'+str(i)].visible==False:
# scene.objects['Drill_tile-'+str(i)].worldPosition.x = x
# scene.objects['Drill_tile-'+str(i)].worldPosition.y = y
# scene.objects['Drill_tile-'+str(i)].setVisible(True,True)
# break
# for obj_i in scene.objects:
# if "tile_dirtHigh" in obj_i.name:
# if round(obj_i.worldPosition.x) == x and round(obj_i.worldPosition.y) == y :
# obj_i.setVisible(False, True)
###############################################################################
# Temporisation

View File

@ -137,7 +137,7 @@ missions_task.update({"6" : [mission_6_task]})
def get_missions_card():
return missions_card
def get_card_description():
def get_missions_description():
return missions_card_description
###############################################################################
@ -196,6 +196,14 @@ def map_reset():
mission_init = missions_conf[str(scene.objects['Points']['mission'])][0]
mission_aim = missions_conf[str(scene.objects['Points']['mission'])][1]
# Reterasser le terrain (mission 6)
for obj_i in scene.objects:
if "tile_dirtHigh" in obj_i.name:
if obj_i.visible == False:
obj_i.setVisible(True, True)
for i in range (10):
scene.objects["Drill_tile-"+str(i)].setVisible(False, True)
# Cacher les balises
scene.objects['Terrain']['map_tile_beacon']= []
for i in range (200):
@ -247,14 +255,13 @@ def map_reset():
obj_aim.worldPosition.x = mission_aim[0]
obj_aim.worldPosition.y = mission_aim[1]
obj_aim.worldPosition.z = 0.5
scene.objects['Terrain']['map_aim']=[]
# bpy.data.materials["Grid-Holo"].node_tree.nodes["Émission"].inputs[1].default_value =5
scene.objects['Terrain']['map_aim']=[] # Liste des cibles
scene.objects['Terrain']['map_aim_hit']=[] # Liste des cibles atteintes
for i in range (10):
position_ok=False
while position_ok==False: # Exclusion de certaines cases
x1= random.randint(3,12)
y1= random.randint(0,9)
# print (x1,y1)
if [x1,y1] in scene.objects['Terrain']['map_aim']:
position_ok=False
else:
@ -367,8 +374,14 @@ def objectif_control(x,y):
# Mission 6 (passer sur tout le terrain)
if scene.objects['Points']['mission']==6:
# FIXME
return False
if [x,y] in scene.objects['Terrain']['map_aim']: # Cibles
if [x,y] not in scene.objects['Terrain']['map_aim_hit']: # Cibles atteintes
rover_drill(x,y)
scene.objects['Terrain']['map_aim_hit'].append([x,y])
if len (scene.objects['Terrain']['map_aim_hit'])==10 : # Toutes les cibles atteintes
return True
return False

View File

@ -1,4 +1,5 @@
from rp_lib import * # Bibliothèque Ropy
import rp_doc # Documentation
###############################################################################
# rp_store.py
@ -28,33 +29,6 @@ JUST_RELEASED = bge.logic.KX_INPUT_JUST_RELEASED
ACTIVATE = bge.logic.KX_INPUT_ACTIVE
# JUST_DEACTIVATED = bge.logic.KX_SENSOR_JUST_DEACTIVATED
################################################################################
# Documentation
################################################################################
# Cards description pour le magasin
storecard_description ={}
# Speed - Vitesse
sc_speed_title="Vitesse"
sc_speed_text="Permet de modifier\nla vitesse des \ndéplacements."
storecard_description.update({"Store-speed-card" : [sc_speed_title, sc_speed_text]})
# Paint - Peinture
sc_paint_title="Peinture"
sc_paint_text="On refait la déco ?"
storecard_description.update({"Store-paint-card" : [sc_paint_title, sc_paint_text]})
# Battery + - Batterie +
sc_battery_title="Batterie +"
sc_battery_text="Augmente la capacité \nde la batterie à 200 \nmouvements (contre \n20, plutôt faible ...)."
storecard_description.update({"Store-battery-card" : [sc_battery_title, sc_battery_text]})
# Beacon + - Balise +
sc_beacon_title="Balise +"
sc_beacon_text="Porte le nombre de \nbalises transportées\nà 200 (contre 20)."
storecard_description.update({"Store-beacon-card" : [sc_beacon_title, sc_beacon_text]})
################################################################################
# Init, open et close
################################################################################
@ -114,6 +88,12 @@ def open2 (cont):
scene.objects['Camera'].setVisible(False,True)
# Animation de la bulle
scene.objects['Bubble-1-text']['Text']="Salut !\n Souhaites tu\n acquerir des\n nouvelles\n ameliorations ?\n"
if scene.objects['Points']['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:
scene.objects['Bubble-1-text']['Text']="Salut ! Si tu veux \n des nouvelles \n ameliorations,\n il te faut passer \n des missions !"
start = 1
end = 20
layer = 0
@ -272,7 +252,7 @@ def card (cont):
scene.objects[name_fct].color = color_store_activate
scene.objects[name_fct+'-icon'].color = color_store_activate
scene.objects[name_fct+'-text'].color = color_store_activate
scene.objects['Store_text']['Text'] = storecard_description[name_fct][1]
scene.objects['Store_text']['Text'] = rp_doc.upgrade_description(name_fct)
scene.objects['Store_text'].setVisible(True, False)
# Upgrade
@ -302,6 +282,7 @@ def upgrade (cont):
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)
###############################################################################
# Rover