mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Mise en place du fichier carte
This commit is contained in:
parent
15dd7f9b4e
commit
553a7869c5
BIN
asset/map/map1.blend
Normal file
BIN
asset/map/map1.blend
Normal file
Binary file not shown.
BIN
ropy-32.blend
BIN
ropy-32.blend
Binary file not shown.
BIN
ropy-33.blend
BIN
ropy-33.blend
Binary file not shown.
BIN
ropy-34.blend
Normal file
BIN
ropy-34.blend
Normal file
Binary file not shown.
8
rp.py
8
rp.py
@ -689,7 +689,7 @@ def mode(cont):
|
||||
if scene.objects['Doc'].visible:
|
||||
tablet_close()
|
||||
return
|
||||
if scene.objects['Store'].visible:
|
||||
if scene.objects['Store-panel'].visible:
|
||||
store_close()
|
||||
return
|
||||
else: # Sortir du jeu
|
||||
@ -1263,10 +1263,10 @@ def upgrade_maj():
|
||||
def store_open ():
|
||||
upgrade_maj()
|
||||
if scene.objects['Grid-u'].visible:
|
||||
scene.objects['Store']['Grid_visible'] = True
|
||||
scene.objects['Store-panel']['Grid_visible'] = True
|
||||
terrain_grid()
|
||||
else:
|
||||
scene.objects['Store']['Grid_visible'] = False
|
||||
scene.objects['Store-panel']['Grid_visible'] = False
|
||||
rp_store.open()
|
||||
|
||||
##
|
||||
@ -1336,7 +1336,7 @@ def store_close():
|
||||
upgrade_maj()
|
||||
|
||||
# Affichage de la grille + mission
|
||||
if scene.objects['Store']['Grid_visible']:
|
||||
if scene.objects['Store-panel']['Grid_visible']:
|
||||
terrain_grid()
|
||||
|
||||
##
|
||||
|
@ -230,6 +230,7 @@ def credits_close(cont):
|
||||
scene.objects["About"].worldPosition.z = scene.objects["About"]['init_lz']
|
||||
scene.objects['Credits'].setVisible(False,True)
|
||||
scene.objects['About'].setVisible(True,True)
|
||||
print ("ici") # FIXME le About ne revient pas ?
|
||||
|
||||
# Overlay
|
||||
scene.objects['Points'].setVisible(True,True)
|
||||
|
@ -32,7 +32,7 @@ def commandes():
|
||||
rp_avancer()
|
||||
rp_avancer()
|
||||
rp_droite()
|
||||
for i in range (10):
|
||||
for i in range (3):
|
||||
rp_avancer()
|
||||
rp_marquer()
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
<data>
|
||||
<config>
|
||||
<speed>1.0</speed>
|
||||
<speed>0.25</speed>
|
||||
<sound>False</sound>
|
||||
<cam>
|
||||
<worldPosition.x>2.8847856521606445</worldPosition.x>
|
||||
<worldPosition.y>-26.193437576293945</worldPosition.y>
|
||||
<worldPosition.z>20.51732063293457</worldPosition.z>
|
||||
<worldPosition.x>-9.421216011047363</worldPosition.x>
|
||||
<worldPosition.y>-7.438669204711914</worldPosition.y>
|
||||
<worldPosition.z>9.524099349975586</worldPosition.z>
|
||||
</cam>
|
||||
<screen>
|
||||
<width>1333</width>
|
||||
<height>749</height>
|
||||
<width>1599</width>
|
||||
<height>900</height>
|
||||
<quality>4</quality>
|
||||
</screen>
|
||||
</config>
|
||||
@ -21,6 +21,6 @@
|
||||
<battery>False</battery>
|
||||
<beacon>False</beacon>
|
||||
<paint>False</paint>
|
||||
<speed>False</speed>
|
||||
<speed>True</speed>
|
||||
</upgrade>
|
||||
</data>
|
31
rp_map1.py
31
rp_map1.py
@ -143,12 +143,35 @@ def get_missions_description():
|
||||
def map_init():
|
||||
|
||||
# Terrain
|
||||
file_path = 'asset/map/map1.blend'
|
||||
inner_path = 'Object'
|
||||
object_name = 'Terrain'
|
||||
bpy.ops.wm.append(
|
||||
filepath=os.path.join(file_path, inner_path, object_name),
|
||||
directory=os.path.join(file_path, inner_path),
|
||||
filename=object_name)
|
||||
|
||||
scene.objects['Terrain']['size'] = [-15,-11,15,10] # Map size
|
||||
scene.objects['Terrain']['map_tile_montain']= []
|
||||
scene.objects['Terrain']['map_tile_station']= [[-9,2],[-9,3]]
|
||||
for obj_i in scene.objects:
|
||||
if "terrain_sideCliff" in obj_i.name or "terrain_sideCorner" in obj_i.name or "terrain_sideCornerInner" in obj_i.name:
|
||||
scene.objects['Terrain']['map_tile_montain'].append([round(obj_i.worldPosition.x), round(obj_i.worldPosition.y)])
|
||||
|
||||
# Détection des emplacements des colisions de montagne
|
||||
# scene.objects['Terrain']['map_tile_montain']= []
|
||||
# for obj_i in scene.objects:
|
||||
# if "terrain_sideCliff" in obj_i.name or "terrain_sideCorner" in obj_i.name or "terrain_sideCornerInner" in obj_i.name:
|
||||
# scene.objects['Terrain']['map_tile_montain'].append([round(obj_i.worldPosition.x), round(obj_i.worldPosition.y)])
|
||||
scene.objects['Terrain']['map_tile_montain'] = [[-9, -1], [1, -9], [-14, -8], [-12, -10], [-11, -10], [-10, -10], [-9, -10], [-11, 1], [-14, 3], [-14, 4], [-14, -7], [-12, 1], [2, -7], [-12, 10],
|
||||
[-11,10], [-10, 10], [-9, 10], [-8, 10], [-4, 7], [-2, 6], [4, 10], [5, 10], [1, 8], [2, -6], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [11, 10],
|
||||
[14,7], [-14, -1], [13, 8], [-14, 0], [-14, -2], [8, -1], [-15, -7], [-15, -8], [-15, -9], [-15, -6], [-8, -10], [-7, -10], [10, -1], [15, 5], [11, -1],
|
||||
[14, 9], [15, 10], [12, -1], [4, -9], [5, -9], [6, -9], [3, -10], [7, -10], [-14, -11], [-6, -11], [3, -11], [7, -11], [0, -11], [0, 1], [-1, 0], [13, 7],
|
||||
[13, 6], [13, 5], [1, 1], [0, -1], [14, 10], [13, 9], [14, 8], [14, 6], [12, 10], [15, 9], [15, 3], [9, -1], [7, -1], [15, 8], [15, 7], [6, -1], [2, -5],
|
||||
[2, -4], [2, -3], [2, -2], [5, -1], [4, -1], [3, -1], [3, 10], [-1, 6], [0, -10], [-13, -9], [1, -8], [-12, -3], [-9, -2], [-12, -5], [-13, -6], [-13, 5],
|
||||
[-13, 6], [-14, 8], [-13, 2], [-10, -3], [-13, 9], [-7, 9], [-14, 7], [-6, 8], [-5, 7], [-3, 6], [0, 6], [1, 7], [2, 9], [-10, 1], [-9, 0], [-15, 2],
|
||||
[-14,1], [-14, -10], [-14, -5], [-13, -4], [-13, -3], [2, -1], [13, 4], [14, 3], [15, 6], [13, -1], [14, -2], [-6, -10], [15, -3], [14, 5], [3, -9],
|
||||
[7,-9], [-13, 10], [-13, 10], [15, -4], [15, -4], [14, -3], [14, -3], [-14, 9], [-14, 9], [-14, 6], [-14, 6], [-14, 5], [-14, 5], [-14, 2], [-14, 2],
|
||||
[-13,1], [-13, 1], [-10, 0], [-10, 0], [-10, -2], [-10, -2], [-11, -3], [-11, -3], [-12, -4], [-12, -4], [-13, -5], [-13, -5], [-14, -6], [-14, -6],
|
||||
[-14,-9], [-14, -9], [-13, -10], [-13, -10], [-7, 10], [-7, 10], [-6, 9], [-6, 9], [-5, 8], [-5, 8], [-3, 7], [-3, 7], [0, 7], [0, 7], [1, 9], [1, 9],
|
||||
[2,10], [2, 10], [13, 10], [13, 10], [13, -2], [13, -2], [-15, -10], [-15, -10], [1, -10], [1, -10], [-15, 1], [-15, 1], [-15, -5], [-15, -5], [-14, -4],
|
||||
[-14, -4], [-14, -3], [-14, -3], [-15, 8], [-15, 8], [14, 4], [14, 4], [-15, 7], [-15, 7], [2, -8], [2, -8]]
|
||||
|
||||
# Couleurs
|
||||
rp_couleur_init()
|
||||
|
82
rp_store.py
82
rp_store.py
@ -39,17 +39,17 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE
|
||||
def init():
|
||||
|
||||
# Mémorisation de la position de la tablette du store
|
||||
scene.objects["Store"]['init_lx']=scene.objects["Store"].worldPosition.x
|
||||
scene.objects["Store"]['init_ly']=scene.objects["Store"].worldPosition.y
|
||||
scene.objects["Store"]['init_lz']=scene.objects["Store"].worldPosition.z
|
||||
scene.objects["Store-panel"]['init_lx']=scene.objects["Store-panel"].worldPosition.x
|
||||
scene.objects["Store-panel"]['init_ly']=scene.objects["Store-panel"].worldPosition.y
|
||||
scene.objects["Store-panel"]['init_lz']=scene.objects["Store-panel"].worldPosition.z
|
||||
|
||||
# Placement de la position de la tablette du store
|
||||
scene.objects['Store'].worldScale = [0.01, 0.01, 0.01]
|
||||
# applyRotationTo(scene.objects['Store'], None, (-0.2*math.pi)/180, (115*math.pi)/180, False)
|
||||
applyRotationTo(scene.objects['Store'], None, (-2.38*math.pi)/180, (100*math.pi)/180, False) # dernière version
|
||||
# scene.objects['Store'].applyRotation((math.pi/2+(0.59189*math.pi)/180, 0, 0), True)
|
||||
# scene.objects['Store'].applyRotation((math.pi/4+(2*math.pi)/180, 0, 0), True) # avant dernière version
|
||||
scene.objects['Store'].applyRotation((math.pi/2+(3*math.pi)/180, 0, 0), True) # dernière version
|
||||
scene.objects['Store-panel'].worldScale = [0.01, 0.01, 0.01]
|
||||
# applyRotationTo(scene.objects['Store-panel'], None, (-0.2*math.pi)/180, (115*math.pi)/180, False)
|
||||
applyRotationTo(scene.objects['Store-panel'], None, (-2.38*math.pi)/180, (100*math.pi)/180, False) # dernière version
|
||||
# scene.objects['Store-panel'].applyRotation((math.pi/2+(0.59189*math.pi)/180, 0, 0), True)
|
||||
# scene.objects['Store-panel'].applyRotation((math.pi/4+(2*math.pi)/180, 0, 0), True) # avant dernière version
|
||||
scene.objects['Store-panel'].applyRotation((math.pi/2+(3*math.pi)/180, 0, 0), True) # dernière version
|
||||
|
||||
##
|
||||
# Ouverture du store
|
||||
@ -123,15 +123,15 @@ def open2 (cont):
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card"].color = color_store_fct
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card-icon"].color = color_store_fct
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card-text"].color = color_store_fct
|
||||
scene.objects['Store']['page_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'])
|
||||
|
||||
# Animation de la tablette
|
||||
scene.objects['Store'].setVisible(True,True)
|
||||
scene.objects['Store'].worldPosition = [-12.25, -2.7, 0.4]
|
||||
scene.objects['Store']['timer'] = 0
|
||||
scene.objects['Store']['anim'] = True
|
||||
scene.objects['Store-panel'].setVisible(True,True)
|
||||
scene.objects['Store-panel'].worldPosition = [-12.25, -2.7, 0.4]
|
||||
scene.objects['Store-panel']['timer'] = 0
|
||||
scene.objects['Store-panel']['anim'] = True
|
||||
scene.objects['Store_upgrade'].setVisible(False, True)
|
||||
scene.objects['Store_upgrade-colbox'].suspendPhysics (True)
|
||||
scene.objects['Store_text'].setVisible(False,True)
|
||||
@ -148,28 +148,28 @@ def open_anim():
|
||||
x1 = -9.05968
|
||||
y1 = -5.01656
|
||||
z1= 0.521224
|
||||
xi = x0+((x1-x0)/resol)*scene.objects['Store']['timer']
|
||||
yi = y0+((y1-y0)/resol)*scene.objects['Store']['timer']
|
||||
zi = z0+((z1-z0)/resol)*scene.objects['Store']['timer']
|
||||
xi = x0+((x1-x0)/resol)*scene.objects['Store-panel']['timer']
|
||||
yi = y0+((y1-y0)/resol)*scene.objects['Store-panel']['timer']
|
||||
zi = z0+((z1-z0)/resol)*scene.objects['Store-panel']['timer']
|
||||
scale0=0.01
|
||||
# scale1=0.169
|
||||
scale1=0.2
|
||||
scalei = scale0+((scale1-scale0)/resol)*scene.objects['Store']['timer']
|
||||
scene.objects['Store'].worldPosition = [xi, yi, zi]
|
||||
scene.objects['Store'].worldScale = [scalei, scalei, scalei]
|
||||
scene.objects['Store']['timer']+=1
|
||||
if scene.objects['Store']['timer']== resol:
|
||||
scene.objects['Store']['anim'] = False
|
||||
scalei = scale0+((scale1-scale0)/resol)*scene.objects['Store-panel']['timer']
|
||||
scene.objects['Store-panel'].worldPosition = [xi, yi, zi]
|
||||
scene.objects['Store-panel'].worldScale = [scalei, scalei, scalei]
|
||||
scene.objects['Store-panel']['timer']+=1
|
||||
if scene.objects['Store-panel']['timer']== resol:
|
||||
scene.objects['Store-panel']['anim'] = False
|
||||
|
||||
##
|
||||
# Fermeture
|
||||
##
|
||||
|
||||
def close ():
|
||||
scene.objects["Store"].worldPosition.x=scene.objects["Store"]['init_lx']
|
||||
scene.objects["Store"].worldPosition.y=scene.objects["Store"]['init_ly']
|
||||
scene.objects["Store"].worldPosition.z=scene.objects["Store"]['init_lz']
|
||||
scene.objects['Store'].setVisible(False,True)
|
||||
scene.objects["Store-panel"].worldPosition.x=scene.objects["Store"]['init_lx']
|
||||
scene.objects["Store-panel"].worldPosition.y=scene.objects["Store"]['init_ly']
|
||||
scene.objects["Store-panel"].worldPosition.z=scene.objects["Store"]['init_lz']
|
||||
scene.objects['Store-panel'].setVisible(False,True)
|
||||
scene.objects['Bubble-1'].setVisible(False,True)
|
||||
# scene.objects['Bubble-1-text'].setVisible(False,True)
|
||||
|
||||
@ -210,7 +210,7 @@ def hl (cont):
|
||||
if name == "Store_close" or name == "Store_upgrade":
|
||||
scene.objects[name].color = color_store_fct
|
||||
else:
|
||||
if name == scene.objects['Store']['page_fct'] :
|
||||
if name == scene.objects['Store-panel']['page_fct'] :
|
||||
scene.objects[name].color = color_store_activate
|
||||
scene.objects[name_text].color = color_store_activate
|
||||
scene.objects[name_icon].color = color_store_activate
|
||||
@ -235,18 +235,18 @@ def card (cont):
|
||||
scene.objects['Store_text']['Text'] = " "
|
||||
|
||||
# Enlever l'ancienne carte
|
||||
if scene.objects['Store']['page_fct'] !="":
|
||||
if scene.objects[scene.objects['Store']['page_fct']]['upgraded'] == True:
|
||||
scene.objects[scene.objects['Store']['page_fct']].color = color_store_upgraded
|
||||
scene.objects[scene.objects['Store']['page_fct']+'-text'].color = color_store_upgraded
|
||||
scene.objects[scene.objects['Store']['page_fct']+'-icon'].color = color_store_upgraded
|
||||
if scene.objects['Store-panel']['page_fct'] !="":
|
||||
if scene.objects[scene.objects['Store-panel']['page_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
|
||||
else:
|
||||
scene.objects[scene.objects['Store']['page_fct']].color = color_store_fct
|
||||
scene.objects[scene.objects['Store']['page_fct']+'-text'].color = color_store_fct
|
||||
scene.objects[scene.objects['Store']['page_fct']+'-icon'].color = color_store_fct
|
||||
scene.objects[scene.objects['Store-panel']['page_fct']].color = color_store_fct
|
||||
scene.objects[scene.objects['Store-panel']['page_fct']+'-text'].color = color_store_fct
|
||||
scene.objects[scene.objects['Store-panel']['page_fct']+'-icon'].color = color_store_fct
|
||||
|
||||
# Afficher le texte de la carte
|
||||
scene.objects['Store']['page_fct'] = name_fct
|
||||
scene.objects['Store-panel']['page_fct'] = name_fct
|
||||
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
|
||||
@ -269,12 +269,12 @@ def upgrade (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['Store']['page_fct']
|
||||
name_fct = scene.objects['Store-panel']['page_fct']
|
||||
if name_fct !="":
|
||||
scene.objects[name_fct]['upgraded'] = True
|
||||
scene.objects[scene.objects['Store']['page_fct']].color = color_store_upgraded
|
||||
scene.objects[scene.objects['Store']['page_fct']+'-text'].color = color_store_upgraded
|
||||
scene.objects[scene.objects['Store']['page_fct']+'-icon'].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']+'-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'])
|
||||
|
Loading…
Reference in New Issue
Block a user