refonte des icones

This commit is contained in:
Philippe Roy 2022-03-13 05:32:55 +01:00
parent 9f046aa9d0
commit 113fd09c9c
9 changed files with 99 additions and 13729 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M19 -16 L19 -4 Q19 -2.75 18.15 -1.85 L15 1.25 15 10.75 18.15 13.9 Q19 14.75 19 16 L19 20 Q19 21.25 18.15 22.15 17.25 23 16 23 L-16 23 Q-17.25 23 -18.1 22.15 -19 21.25 -19 20 L-19 16 Q-19 14.75 -18.1 13.9 L-15 10.75 -15 1.25 -18.1 -1.85 Q-19 -2.75 -19 -4 L-19 -16 Q-19 -17.25 -18.1 -18.1 -17.25 -19 -16 -19 L-12 -19 Q-10.75 -19 -9.85 -18.1 -9 -17.25 -9 -16 L-9 -11 -7 -11 -7 -16 Q-7 -17.25 -6.1 -18.1 -5.25 -19 -4 -19 L4 -19 Q5.25 -19 6.15 -18.1 7 -17.25 7 -16 L7 -11 9 -11 9 -16 Q9 -17.25 9.9 -18.1 10.75 -19 12 -19 L16 -19 Q17.25 -19 18.15 -18.1 19 -17.25 19 -16"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 722 B

64
ct.py
View File

@ -27,7 +27,7 @@ ct_cmd = importlib.import_module('ct_cmd')
# Récupérer la scène UPBGE # Récupérer la scène UPBGE
scene = bge.logic.getCurrentScene() scene = bge.logic.getCurrentScene()
# print("Objets de la scene : ", scene.objects) # scene_non_contruct = [] # Liste des tuiles non constructibles
# Couleurs # Couleurs
@ -65,6 +65,7 @@ def cmd_construct_tour(cont):
obj_Hl.color = couleur_cmd obj_Hl.color = couleur_cmd
scene.objects['Tour_construc_mode'].setVisible(False,False) scene.objects['Tour_construc_mode'].setVisible(False,False)
scene.objects['Tour_construc_mode'].color = couleur_cmd scene.objects['Tour_construc_mode'].color = couleur_cmd
scene.objects['Texte_info'].setVisible(False,False)
else: else:
scene.objects['Terrain']['construct_mode']=True scene.objects['Terrain']['construct_mode']=True
obj.worldScale=[1.25, 1.25, 1.25] obj.worldScale=[1.25, 1.25, 1.25]
@ -73,6 +74,8 @@ def cmd_construct_tour(cont):
obj_Hl.color = couleur_cmd_hl obj_Hl.color = couleur_cmd_hl
scene.objects['Tour_construc_mode'].setVisible(True,False) scene.objects['Tour_construc_mode'].setVisible(True,False)
scene.objects['Tour_construc_mode'].color = couleur_cmd scene.objects['Tour_construc_mode'].color = couleur_cmd
scene.objects['Texte_info'].setVisible(True,False)
scene.objects['Texte_info']['Text']="Position tour : "
# Affiche position # Affiche position
def construct_tour_pos(cont): def construct_tour_pos(cont):
@ -81,22 +84,62 @@ def construct_tour_pos(cont):
hitObject = cont.sensors['MO'].hitObject hitObject = cont.sensors['MO'].hitObject
hitPosition = cont.sensors['MO'].hitPosition hitPosition = cont.sensors['MO'].hitPosition
if hitObject is not None : if hitObject is not None :
print (hitObject.name) if [round(hitPosition.x),round(hitPosition.y)] in scene.objects['Terrain']['scene_non_contruct']:
print (hitPosition) pass
else:
scene.objects['Tour_construc_mode'].worldPosition.x=round(hitPosition.x) scene.objects['Tour_construc_mode'].worldPosition.x=round(hitPosition.x)
scene.objects['Tour_construc_mode'].worldPosition.y=round(hitPosition.y) scene.objects['Tour_construc_mode'].worldPosition.y=round(hitPosition.y)
scene.objects['Tour_construc_mode'].worldPosition.z=0.2 scene.objects['Tour_construc_mode'].worldPosition.z=0.2
scene.objects['Texte_info']['Text']="Position tour : "+str(round(hitPosition.x))+","+str(round(hitPosition.y))
############################################################################### ###############################################################################
# Cycle # Terrain
############################################################################### ###############################################################################
# Initialisation du cycle de fonctionnement normal # Mise à jour de l'affichage des compteurs
# def cycle_init (cont): def points_maj (cont):
# pass
# Affichage
scene.objects['Vies_texte']['Text']=str(scene.objects['Points']['vies'])+"/"+str(scene.objects['Points']['vies_max'])
scene.objects['Pieces_texte']['Text']=str(scene.objects['Points']['pieces'])
scene.objects['Level_texte']['Text']=str(scene.objects['Points']['level'])+"/"+str(scene.objects['Points']['level_max'])
scene.objects['Minions_texte']['Text']=str(scene.objects['Points']['minions'])
# Fin de la vague
if scene.objects['Terrain']['thread_vague']==False:
if scene.objects['Points']['minions']==0:
terrain_fin ()
# Initialisation lors du chargement du terrain
def terrain_init (cont):
# Mise à zéro des compteurs
scene.objects['Points']['vies']=10
scene.objects['Points']['vies_max']=10
scene.objects['Points']['pieces']=0
scene.objects['Points']['level']=0
scene.objects['Points']['level_max']=1
scene.objects['Points']['minions']=0
# Initialisation lors du chargement du terrain
def terrain_init (cont):
# Mise à zéro des compteurs
# scene.objects['Vies_texte']['Text']="10/10"
# scene.objects['Pieces_texte']['Text']="0"
# scene.objects['Level_texte']['Text']="1"
# scene.objects['Minions_texte']['Text']="0"
# Recherche les tuiles non constructibles
scene.objects['Terrain']['scene_non_contruct'] = []
for i in range (len(scene.objects)):
if "tile_straight" in scene.objects[i].name:
scene.objects['Terrain']['scene_non_contruct'].append([scene.objects[i].worldPosition.x, scene.objects[i].worldPosition.y])
if "tile_cornerRound" in scene.objects[i].name:
scene.objects['Terrain']['scene_non_contruct'].append([scene.objects[i].worldPosition.x, scene.objects[i].worldPosition.y])
# Mise en route et pause du cycle # Mise en route et pause du cycle
def cycle_run (cont): def terrain_run (cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and scene.objects['Terrain']['manip_mode']==0: if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and scene.objects['Terrain']['manip_mode']==0:
# Pause # Pause
@ -125,7 +168,7 @@ def cycle_run (cont):
ct_vg.start() # Lancement des vagues ct_vg.start() # Lancement des vagues
# Arrêt et réinitialisation du cycle # Arrêt et réinitialisation du cycle
def cycle_stop (cont): def terrain_stop (cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and scene.objects['Terrain']['manip_mode']==0: if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and scene.objects['Terrain']['manip_mode']==0:
# Arrêt des threads utilisateurs # Arrêt des threads utilisateurs
@ -146,7 +189,7 @@ def cycle_stop (cont):
scene.objects['Stop-Hl'].setVisible(False,False) scene.objects['Stop-Hl'].setVisible(False,False)
# Fin naturelle du cycle # Fin naturelle du cycle
def cycle_fin (): def terrain_fin ():
scene.objects['Terrain']['run']=False scene.objects['Terrain']['run']=False
scene.objects['Terrain']['thread_run']=False scene.objects['Terrain']['thread_run']=False
@ -172,6 +215,7 @@ def cmd_init():
scene.objects['Construc-Hl'].setVisible(False,False) scene.objects['Construc-Hl'].setVisible(False,False)
scene.objects['Tour_construc_mode'].setVisible(False,False) scene.objects['Tour_construc_mode'].setVisible(False,False)
scene.objects['Texte_info'].setVisible(False,False)
# scene.objects['Raz-vue-Hl'].setVisible(False,False) # scene.objects['Raz-vue-Hl'].setVisible(False,False)
# scene.objects['Aide-cmd-Hl'].setVisible(False,False) # scene.objects['Aide-cmd-Hl'].setVisible(False,False)

View File

@ -37,7 +37,8 @@ def commandes():
# Coder vos commandes ici ... # Coder vos commandes ici ...
ct_tour(5,5) #ct_tour(12,2)
ct_tour(4,5)
tempo(2) tempo(2)
print ("Thread commandes #", len(threads)-1, "arrivé au bout -> fermeture.") # Tâche close (thread) << NE PAS MODIFIER CETTE LIGNE >> print ("Thread commandes #", len(threads)-1, "arrivé au bout -> fermeture.") # Tâche close (thread) << NE PAS MODIFIER CETTE LIGNE >>

View File

@ -102,18 +102,38 @@ def thread_stop(threads, type_txt):
############################################################################### ###############################################################################
# Vagues # Vagues (minions)
#
# Caractéristiques :
# - Ufo basique : vitesse =1 ; pv_max= 2 (point de vie)
#
############################################################################### ###############################################################################
# Création d'un enemi # Création d'un minion
def ct_ufo(x,y): def ct_minion(x,y):
ufo= scene.addObject("Ufo", scene.objects['Terrain']) ufo= scene.addObject("Ufo", scene.objects['Terrain'])
scene.objects['Points']['minions']= scene.objects['Points']['minions']+1
ufo.worldPosition=mathutils.Vector((x,y,0.37)) ufo.worldPosition=mathutils.Vector((x,y,0.37))
ufo.worldScale=mathutils.Vector((0.25,0.25,0.25)) ufo.worldScale=mathutils.Vector((0.25,0.25,0.25))
ufo.actuators['Steering'].velocity=ufo['vitesse'] ufo.actuators['Steering'].velocity=ufo['vitesse']
# Dégats sur minion
# def scn_minion_degat(cont):
# obj = cont.owner
# sensor = obj.sensors['Collision']
# obj['pv'] = obj['pv']- sensor.hitObject['degat']
# sensor.hitObject.endObject()
# if obj['pv']<=0:
# scene.objects['Points']['pieces']= scene.objects['Points']['pieces']+obj['pieces']
# obj.endObject()
# scene.objects['Points']['minions']= scene.objects['Points']['minions']-1
############################################################################### ###############################################################################
# Tours # Tours
#
# Caractéristiques :
# - Tour basique : dégats = 1.0 ; portée = 3.0 ; vitesse =0,2
#
############################################################################### ###############################################################################
# Création d'une tour # Création d'une tour
@ -121,35 +141,33 @@ def ct_tour(x,y):
tour= scene.addObject("Tour", scene.objects['Terrain']) tour= scene.addObject("Tour", scene.objects['Terrain'])
tour.worldPosition=mathutils.Vector((x,y,0.2)) tour.worldPosition=mathutils.Vector((x,y,0.2))
tour.worldScale=mathutils.Vector((1,1,1)) tour.worldScale=mathutils.Vector((1,1,1))
scene.objects['Terrain']['scene_non_contruct'].append([x,y])
# Réaction d'une tour # Réaction d'une tour
def scn_tour_near(cont): def scn_tour_near(cont):
obj = cont.owner obj = cont.owner
sensor = obj.sensors['Near'] sensor = obj.sensors['Near']
# Supression enemi
if len(sensor.hitObjectList)>0: if len(sensor.hitObjectList)>0:
# Tir sur minion
target=sensor.hitObjectList[0]
bullet= scene.addObject("Bullet", scene.objects['Terrain'], 60*2, False) bullet= scene.addObject("Bullet", scene.objects['Terrain'], 60*2, False)
# bullet['degat'] = obj['degat']
bullet.mass=0.001 # bullet.applyForce=((0,0,9.81),True) bullet.mass=0.001 # bullet.applyForce=((0,0,9.81),True)
bullet.worldPosition=mathutils.Vector((obj.worldPosition.x,obj.worldPosition.y,1.5)) bullet.worldPosition=mathutils.Vector((obj.worldPosition.x,obj.worldPosition.y,1.5))
# bullet.worldScale=mathutils.Vector((0.5,0.5,0.5)) # bullet.worldScale=mathutils.Vector((0.5,0.5,0.5))
bullet.worldScale=[0.5,0.5,0.5] bullet.worldScale=[0.5,0.5,0.5]
bullet.worldLinearVelocity.x = (sensor.hitObjectList[0].worldPosition.x-bullet.worldPosition.x)*bullet['vitesse'] bullet.worldLinearVelocity.x = (target.worldPosition.x-bullet.worldPosition.x)*bullet['vitesse']
bullet.worldLinearVelocity.y= (sensor.hitObjectList[0].worldPosition.y-bullet.worldPosition.y)*bullet['vitesse'] bullet.worldLinearVelocity.y= (target.worldPosition.y-bullet.worldPosition.y)*bullet['vitesse']
bullet.worldLinearVelocity.z = (sensor.hitObjectList[0].worldPosition.z+0.1-bullet.worldPosition.z)*bullet['vitesse'] bullet.worldLinearVelocity.z = (target.worldPosition.z+0.1-bullet.worldPosition.z)*bullet['vitesse']
# Fin de la vague # Dégats sur minion
if len(sensor.hitObjectList)==0: target['pv'] = target['pv']- obj['degat']
print ("fin vague") # bullet.endObject()
if scene.objects['Terrain']['thread_vague']==False: if target['pv']<=0:
print ("fin vague2") scene.objects['Points']['pieces']= scene.objects['Points']['pieces']+target['pieces']
ct.cycle_fin () target.endObject()
scene.objects['Points']['minions']= scene.objects['Points']['minions']-1
# # Positionnement tour
# def scn_tour_construct(cont):
# obj = cont.owner
# obj.worldScale=[1.25, 1.25, 1.25]
# obj.color = couleur_cmd_hl
############################################################################### ###############################################################################

View File

@ -36,7 +36,7 @@ def vagues():
# Vague 1 # Vague 1
for i in range (4): for i in range (4):
ct_ufo(15,3) ct_minion(15,3)
tempo(1) tempo(1)
tempo(2) tempo(2)