Add new function description

This commit is contained in:
Philippe Roy 2022-07-31 04:10:28 +02:00
parent 812cb09411
commit 62acccb016
6 changed files with 145 additions and 57 deletions

Binary file not shown.

3
ct.py
View File

@ -285,6 +285,7 @@ def terrain_init ():
scene.objects['End'].setVisible(False,True) scene.objects['End'].setVisible(False,True)
scene.objects['End']['timer']=0 scene.objects['End']['timer']=0
scene.objects['Doc'].setVisible(False,True) scene.objects['Doc'].setVisible(False,True)
ct_doc.init()
# Ajout du Hud # Ajout du Hud
scene.active_camera = scene.objects["Camera"] scene.active_camera = scene.objects["Camera"]
@ -1137,7 +1138,7 @@ def book_open ():
scene.objects['Construc-underlay'].setVisible(True,False) scene.objects['Construc-underlay'].setVisible(True,False)
# Initialisation du livre # Initialisation du livre
ct_doc.init() ct_doc.open()
## ##
# Fermer le livre # Fermer le livre

View File

@ -1,6 +1,6 @@
<data> <data>
<config> <config>
<speed>4.0</speed> <speed>1.0</speed>
<sound>False</sound> <sound>False</sound>
</config> </config>
</data> </data>

182
ct_doc.py
View File

@ -50,13 +50,14 @@ fct_description ={}
map_card=["Level-card", "Sleep-card"] map_card=["Level-card", "Sleep-card"]
# ct_level () # ct_level ()
ct_level_title="Get your level" ct_level_title = "\n Get your level"
ct_level_text=" ct_level ()\n \v - Return your level (integer)" ct_level_text = "\n \n ct_level ()\n \v - Return your level (integer)\n \n"
ct_level_text = ct_level_text + " For each new tower, new upgrade, \n new tech or new spell, you spend one \n level-point.\n"
fct_description.update({"Level-card" : [ct_level_title, ct_level_text]}) fct_description.update({"Level-card" : [ct_level_title, ct_level_text]})
# ct_sleep (delay) # ct_sleep (delay)
ct_sleep_title="Time management" ct_sleep_title="\n Time management"
ct_sleep_text=" ct_sleep (delay)\n \v - delay : duration in seconds (float)" ct_sleep_text="\n \n ct_sleep (delay)\n \v - delay : duration in seconds (float)"
fct_description.update({"Sleep-card" : [ct_sleep_title, ct_sleep_text]}) fct_description.update({"Sleep-card" : [ct_sleep_title, ct_sleep_text]})
############################################################################### ###############################################################################
@ -67,7 +68,7 @@ tower_card=["Build-card", "Remove-card", "Upgrade-card", "Activate-card", "Tune-
# ct_build (x, y, category, name, color, style) # ct_build (x, y, category, name, color, style)
ct_build_title="Build a tower" ct_build_title="Build a tower"
ct_build_text="ct_build (x,y, category, name, color, style)\n \v- x position (integer)\n \v- y position (integer)\n" ct_build_text="ct_build (x,y, category, name, color, style)\n \v- x tower location (integer)\n \v- y tower location (integer)\n"
ct_build_text = ct_build_text +" \v- category (string) : \n \v \v- \"Archer tower\" (default value)\n \v \v- \"Mage tower\"\n" ct_build_text = ct_build_text +" \v- category (string) : \n \v \v- \"Archer tower\" (default value)\n \v \v- \"Mage tower\"\n"
ct_build_text = ct_build_text +" \v- name (string)\n \v- color (RGB tuple, default=purple)\n" ct_build_text = ct_build_text +" \v- name (string)\n \v- color (RGB tuple, default=purple)\n"
ct_build_text = ct_build_text +" \v- style (string) : \n \v \v- \"square\" (default value) or \"round\"\n \v \v- version : A (default value), B or C\n \v \v- exemple : 'round-B' \n" ct_build_text = ct_build_text +" \v- style (string) : \n \v \v- \"square\" (default value) or \"round\"\n \v \v- version : A (default value), B or C\n \v \v- exemple : 'round-B' \n"
@ -77,31 +78,49 @@ ct_build_text = ct_build_text +"Exemple : ct_build (1, 1, \"Archer tower\", \n \
fct_description.update({"Build-card" : [ct_build_title, ct_build_text]}) fct_description.update({"Build-card" : [ct_build_title, ct_build_text]})
# ct_remove (x, y) # ct_remove (x, y)
ct_remove_title="Remove a tower" ct_remove_title="\n Remove a tower"
ct_remove_text=" ct_remove (x, y) \n \v - x position (integer)\n \v - y position (integer)\n" ct_remove_text="\n \n ct_remove (x, y) \n \v - x tower location (integer)\n \v - y tower location (integer)\n \n"
ct_remove_text = ct_remove_text + " When you destroy a tower you regain \n the level-points spent by the tower."
fct_description.update({"Remove-card" : [ct_remove_title, ct_remove_text]}) fct_description.update({"Remove-card" : [ct_remove_title, ct_remove_text]})
# ct_upgrade (x, y) # ct_upgrade (x, y)
ct_upgrade_title="Upgrade a tower" ct_upgrade_title="\n Upgrade / downgrade a tower"
ct_upgrade_text=" ct_upgrade (x, y) \n \v - x position (integer)\n \v - y position (integer)\n" ct_upgrade_text="\n \n ct_upgrade (x, y, value) \n \v - x tower location (integer)\n \v - y tower location (integer)\n \v - value (integer)\n \n"
ct_upgrade_text = ct_upgrade_text +"FIXME\n" ct_upgrade_text = ct_upgrade_text + " You change the tower level by adding \n the value. \n \n"
ct_upgrade_text = ct_upgrade_text + " For downgrading, the value have to \n be negative."
fct_description.update({"Upgrade-card" : [ct_upgrade_title, ct_upgrade_text]}) fct_description.update({"Upgrade-card" : [ct_upgrade_title, ct_upgrade_text]})
# ct_activate (x, y) # ct_activate (x, y)
ct_activate_title="activate/desactivate a tower" ct_activate_title="\n Activate/desactivate a tower"
ct_activate_text=" ct_activate (x, y, activate) \n \v - x position (integer)\n \v - y position (integer)\n \v - activate (bool)\n" ct_activate_text="\n \n ct_activate (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_activate_text = ct_activate_text +" \v - state (bool) : \n \v \v - True (default value) : set \n \v \v - False : unset\n \n"
ct_activate_text = ct_activate_text + " When you desactivate a tower you \n regain the level-points spent by the \n tower.\n \n"
ct_activate_text = ct_activate_text + " When you reactivate a tower, you must \n to have the amount of level-points \n spent by the tower."
fct_description.update({"Activate-card" : [ct_activate_title, ct_activate_text]}) fct_description.update({"Activate-card" : [ct_activate_title, ct_activate_text]})
# ct_tune (x, y) # ct_tune (x, y)
ct_tune_title="Tune a tower" ct_tune_title="Tune a tower"
ct_tune_text=" ct_tune (x, y) \n \v - x position (integer)\n \v - y position (integer)\n" ct_tune_text=" ct_tune (x, y, damage, speed, range) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_tune_text = ct_tune_text +"FIXME\n" ct_tune_text = ct_tune_text + " \v - damage (float)\n \v - speed (float)\n \v - range (float)\n \n"
ct_tune_text = ct_tune_text + " You change the tower characteristics. \n"
ct_tune_text = ct_tune_text +" The base value for each characteristic \n is 1."
ct_tune_text = ct_tune_text +" The tower power is the sum : \n damage + speed + range. \n \n"
ct_tune_text = ct_tune_text +" The power depend on the level : \n"
ct_tune_text = ct_tune_text +" \v - level = 2^(power-3)\n"
ct_tune_text = ct_tune_text +" \v - power = ln(level)/ln(2) + 3\n \n"
ct_tune_text = ct_tune_text +" Power : 3 | 4 | 5 | 6 | 7 | 8 | ... \n"
ct_tune_text = ct_tune_text +" Level : 1 | 2 | 4 | 8 | 16 | 32 | ... \n"
fct_description.update({"Tune-card" : [ct_tune_title, ct_tune_text]}) fct_description.update({"Tune-card" : [ct_tune_title, ct_tune_text]})
# ct_targets (x, y) # ct_targets (x, y)
ct_targets_title="FIXME" ct_targets_title = "\n Get the targets list"
ct_targets_text=" ct_targets (x, y) \n \v - x position (integer)\n \v - y position (integer)\n" ct_targets_text=" \n \n ct_targets (x, y) \n \v - x tower location (integer)\n \v - y tower location (integer)\n "
ct_targets_text = ct_targets_text +"FIXME\n" ct_targets_text = ct_targets_text +" \v- Return the list of minions within \n range of the tower (list of \n targets) \n \n"
ct_targets_text = ct_targets_text +" Target (list) : [ name (string), class \n (string), level (integer), distance \n travelled (float),"
ct_targets_text = ct_targets_text +" hp (integer), speed \n (float), armor (float),"
ct_targets_text = ct_targets_text +" bounty (integer), \n lifes_damage (integer) ]"
fct_description.update({"Targets-card" : [ct_targets_title, ct_targets_text]}) fct_description.update({"Targets-card" : [ct_targets_title, ct_targets_text]})
############################################################################### ###############################################################################
@ -111,38 +130,64 @@ fct_description.update({"Targets-card" : [ct_targets_title, ct_targets_text]})
tech_card=["Accurate-card", "Volley-card", "Slow_tech-card", "Fire-card", "Bolt-card", "Ice-card", "Acid-card"] tech_card=["Accurate-card", "Volley-card", "Slow_tech-card", "Fire-card", "Bolt-card", "Ice-card", "Acid-card"]
# ct_accurate # ct_accurate
ct_accurate_title="FIXME" ct_accurate_title="\n Accurate"
ct_accurate_text="FIXME\n" ct_accurate_text="\n \n ct_accurate (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_accurate_text = ct_accurate_text +" \v - state (bool) : \n \v \v - True : set \n \v \v - False : unset\n \n"
ct_accurate_text = ct_accurate_text +" Increases attack damage by 4. \n \n"
ct_accurate_text = ct_accurate_text +" It can't be combined with \'volley\' \n or \'slow\'."
# ct_accurate_text = ct_accurate_text +" With the accurate mode, the damage \n is multiplied by 4 but the tower speed \n is divided by 2."
fct_description.update({"Accurate-card" : [ct_accurate_title, ct_accurate_text]}) fct_description.update({"Accurate-card" : [ct_accurate_title, ct_accurate_text]})
# ct_volley # ct_volley
ct_volley_title="FIXME" ct_volley_title="\n Volley of arrows "
ct_volley_text="FIXME\n" ct_volley_text="\n \n ct_volley (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_volley_text = ct_volley_text +" \v - state (bool) : \n \v \v - True : set \n \v \v - False : unset\n \n"
ct_volley_text = ct_volley_text +" Fires an volley of 4 arrows.\n \n"
ct_volley_text = ct_volley_text +" It can't be combined with \'accurate\' \n or \'slow\'."
# ct_volley_text = ct_volley_text +" With the volley mode, the tower fires \n volley of arrows (4 arrows), but the \n damage is divided by 2."
fct_description.update({"Volley-card" : [ct_volley_title, ct_volley_text]}) fct_description.update({"Volley-card" : [ct_volley_title, ct_volley_text]})
# ct_slow_tech # ct_slow_tech
ct_slow_tech_title="FIXME" ct_slow_tech_title="\n Slow down the target"
ct_slow_tech_text="FIXME\n" ct_slow_tech_text="\n \n ct_slow (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_slow_tech_text = ct_slow_tech_text +" \v - state (bool) : \n \v \v - True : set \n \v \v - False : unset\n \n"
ct_slow_tech_text = ct_slow_tech_text +" Finds the vulnerability for slow down \n the target"
ct_slow_tech_text = ct_slow_tech_text +" (speed divided by 4).\n \n"
ct_slow_tech_text = ct_slow_tech_text +" It can't be combined with \'accurate\' \n or \'volley\'."
# ct_slow_tech_text = ct_slow_tech_text +" (minion speed divided by 2)."
fct_description.update({"Slow_tech-card" : [ct_slow_tech_title, ct_slow_tech_text]}) fct_description.update({"Slow_tech-card" : [ct_slow_tech_title, ct_slow_tech_text]})
# ct_fire # ct_fire
ct_fire_title="FIXME" ct_fire_title="\n Flaming arrow"
ct_fire_text="FIXME\n" ct_fire_text="\n \n ct_fire (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_fire_text = ct_fire_text +" \v - state (bool) : \n \v \v - True : set \n \v \v - False : unset\n \n"
ct_fire_text = ct_fire_text +" Deals fire damage.\n \n"
ct_fire_text = ct_fire_text +" The tower can't cumulate two arrow \n types (fire, bolt, ice, acid) at once."
fct_description.update({"Fire-card" : [ct_fire_title, ct_fire_text]}) fct_description.update({"Fire-card" : [ct_fire_title, ct_fire_text]})
# ct_bolt # ct_bolt
ct_bolt_title="FIXME" ct_bolt_title="\n Charged arrow"
ct_bolt_text="FIXME\n" ct_bolt_text="\n \n ct_bolt (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_bolt_text = ct_bolt_text +" \v - state (bool) : \n \v \v - True : set \n \v \v - False : unset\n \n"
ct_bolt_text = ct_bolt_text +" Deals lighting damage.\n \n"
ct_bolt_text = ct_bolt_text +" The tower can't cumulate two arrow \n types (fire, bolt, ice, acid) at once."
fct_description.update({"Bolt-card" : [ct_bolt_title, ct_bolt_text]}) fct_description.update({"Bolt-card" : [ct_bolt_title, ct_bolt_text]})
# ct_ice # ct_ice
ct_ice_title="FIXME" ct_ice_title="\n Ice arrow"
ct_ice_text="FIXME\n" ct_ice_text="\n \n ct_ice (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_ice_text = ct_ice_text +" \v - state (bool) : \n \v \v - True : set \n \v \v - False : unset\n \n"
ct_ice_text = ct_ice_text +" Deals ice damage.\n \n"
ct_ice_text = ct_ice_text +" The tower can't cumulate two arrow \n types (fire, bolt, ice, acid) at once."
fct_description.update({"Ice-card" : [ct_ice_title, ct_ice_text]}) fct_description.update({"Ice-card" : [ct_ice_title, ct_ice_text]})
# ct_acid # ct_acid
ct_acid_title="FIXME" ct_acid_title="\n Acid arrow"
ct_acid_text="FIXME\n" ct_acid_text="\n \n ct_acid (x, y, state) \n \v - x tower location (integer)\n \v - y tower location (integer)\n"
ct_acid_text = ct_acid_text +" \v - state (bool) : \n \v \v - True : set \n \v \v - False : unset\n \n"
ct_acid_text = ct_acid_text +" Deals acid damage.\n \n"
ct_acid_text = ct_acid_text +" The tower can't cumulate two arrow \n types (fire, bolt, ice, acid) at once."
fct_description.update({"Acid-card" : [ct_acid_title, ct_acid_text]}) fct_description.update({"Acid-card" : [ct_acid_title, ct_acid_text]})
############################################################################### ###############################################################################
@ -183,7 +228,6 @@ fct_description.update({"Aura-card" : [ct_aura_title, ct_aura_text]})
def init(): def init():
# Mettre les pages avec la couleurs par defaut # Mettre les pages avec la couleurs par defaut
scene.objects['Book'].worldPosition = [0, -22, 16.5]
scene.objects['Book_close'].color = color_doc_chap scene.objects['Book_close'].color = color_doc_chap
scene.objects['Book_chap-screen'].color = color_doc_chap scene.objects['Book_chap-screen'].color = color_doc_chap
scene.objects['Book_chap-map'].color = color_doc_chap scene.objects['Book_chap-map'].color = color_doc_chap
@ -191,17 +235,6 @@ def init():
scene.objects['Book_chap-tech'].color = color_doc_chap scene.objects['Book_chap-tech'].color = color_doc_chap
scene.objects['Book_chap-spell'].color = color_doc_chap scene.objects['Book_chap-spell'].color = color_doc_chap
scene.objects['Book_close'].color = color_doc_chap scene.objects['Book_close'].color = color_doc_chap
scene.objects['Book'].setVisible(True,True)
scene.objects['Book_text_title'].setVisible(False,True)
scene.objects['Book_text'].setVisible(False,True)
sound_play (sndbuff_book_open)
# Activer la page screen (page par defaut)
scene.objects['Book']['page_chap'] = "Book_chap-screen"
scene.objects['Book']['page_fct'] = ""
scene.objects['Book_chap-screen'].color = color_doc_activate
scene.objects['Book_page_screen'].worldPosition = scene.objects['Book'].worldPosition
scene.objects['Book_page_screen'].setVisible(True,True)
# Mettre les cartes avec la couleurs par defaut # Mettre les cartes avec la couleurs par defaut
for i in range(len(map_card)): for i in range(len(map_card)):
@ -217,6 +250,47 @@ def init():
scene.objects[spell_card[i]].color = color_doc_fct scene.objects[spell_card[i]].color = color_doc_fct
scene.objects[spell_card[i]+"-colbox"].suspendPhysics() scene.objects[spell_card[i]+"-colbox"].suspendPhysics()
##
# Ouverture du livre
##
def open():
# Afficher le livre
scene.objects['Book'].worldPosition = [0, -22, 16.5]
# scene.objects['Book_close'].color = color_doc_chap
# scene.objects['Book_chap-screen'].color = color_doc_chap
# scene.objects['Book_chap-map'].color = color_doc_chap
# scene.objects['Book_chap-tower'].color = color_doc_chap
# scene.objects['Book_chap-tech'].color = color_doc_chap
# scene.objects['Book_chap-spell'].color = color_doc_chap
# scene.objects['Book_close'].color = color_doc_chap
scene.objects['Book'].setVisible(True,True)
scene.objects['Book_text_title'].setVisible(False,True)
scene.objects['Book_text'].setVisible(False,True)
sound_play (sndbuff_book_open)
# Activer la page screen (page par defaut)
scene.objects['Book']['page_chap'] = "Book_chap-screen"
scene.objects['Book']['page_fct'] = ""
scene.objects['Book_chap-screen'].color = color_doc_activate
scene.objects['Book_page_screen'].worldPosition = scene.objects['Book'].worldPosition
scene.objects['Book_page_screen'].setVisible(True,True)
# # Mettre les cartes avec la couleurs par defaut
# for i in range(len(map_card)):
# scene.objects[map_card[i]].color = color_doc_fct
# scene.objects[map_card[i]+"-colbox"].suspendPhysics()
# for i in range(len(tower_card)):
# scene.objects[tower_card[i]].color = color_doc_fct
# scene.objects[tower_card[i]+"-colbox"].suspendPhysics()
# for i in range(len(tech_card)):
# scene.objects[tech_card[i]].color = color_doc_fct
# scene.objects[tech_card[i]+"-colbox"].suspendPhysics()
# for i in range(len(spell_card)):
# scene.objects[spell_card[i]].color = color_doc_fct
# scene.objects[spell_card[i]+"-colbox"].suspendPhysics()
## ##
# Fermeture du livre # Fermeture du livre
## ##
@ -224,13 +298,24 @@ def init():
def close(): def close():
sound_play (sndbuff_book_close) sound_play (sndbuff_book_close)
# Effacer les fonctions cartes # Cacher les cartes de fonction
scene.objects['Book_page_screen'].setVisible(False,True) scene.objects['Book_page_screen'].setVisible(False,True)
scene.objects['Book_page_map'].setVisible(False,True) scene.objects['Book_page_map'].setVisible(False,True)
scene.objects['Book_page_tower'].setVisible(False,True) scene.objects['Book_page_tower'].setVisible(False,True)
scene.objects['Book_page_tech'].setVisible(False,True) scene.objects['Book_page_tech'].setVisible(False,True)
scene.objects['Book_page_spell'].setVisible(False,True) scene.objects['Book_page_spell'].setVisible(False,True)
# Mettre les cartes avec la couleurs par defaut
for i in range(len(map_card)):
scene.objects[map_card[i]+"-colbox"].suspendPhysics()
for i in range(len(tower_card)):
scene.objects[tower_card[i]+"-colbox"].suspendPhysics()
for i in range(len(tech_card)):
scene.objects[tech_card[i]+"-colbox"].suspendPhysics()
for i in range(len(spell_card)):
scene.objects[spell_card[i]+"-colbox"].suspendPhysics()
# Cacher le livre
scene.objects['Book_page_screen'].setVisible(False,True) scene.objects['Book_page_screen'].setVisible(False,True)
scene.objects['Book'].setVisible(False,True) scene.objects['Book'].setVisible(False,True)
# scene.objects['Book'].worldPosition = [28, 0.84549, 1.53626] # Position dans Blender [28, 0.84549, 1.53626] # scene.objects['Book'].worldPosition = [28, 0.84549, 1.53626] # Position dans Blender [28, 0.84549, 1.53626]
@ -256,7 +341,7 @@ def hl (cont):
if name == scene.objects['Book']['page_chap'] or name == scene.objects['Book']['page_fct'] : if name == scene.objects['Book']['page_chap'] or name == scene.objects['Book']['page_fct'] :
scene.objects[name].color = color_doc_activate scene.objects[name].color = color_doc_activate
else: else:
if name[5]=="c": if name[5:10]=="chap-":
scene.objects[name].color = color_doc_chap scene.objects[name].color = color_doc_chap
else: else:
scene.objects[name].color = color_doc_fct scene.objects[name].color = color_doc_fct
@ -310,7 +395,6 @@ def chapter(cont):
for i in range(len(map_card)): for i in range(len(map_card)):
scene.objects[map_card[i]+"-colbox"].restorePhysics() scene.objects[map_card[i]+"-colbox"].restorePhysics()
# Afficher la page Tower # Afficher la page Tower
if name_chap == "Book_chap-tower": if name_chap == "Book_chap-tower":
scene.objects['Book_page_tower'].worldPosition = scene.objects['Book'].worldPosition scene.objects['Book_page_tower'].worldPosition = scene.objects['Book'].worldPosition
@ -318,7 +402,6 @@ def chapter(cont):
for i in range(len(tower_card)): for i in range(len(tower_card)):
scene.objects[tower_card[i]+"-colbox"].restorePhysics() scene.objects[tower_card[i]+"-colbox"].restorePhysics()
# Afficher la page Tech # Afficher la page Tech
if name_chap == "Book_chap-tech": if name_chap == "Book_chap-tech":
scene.objects['Book_page_tech'].worldPosition = scene.objects['Book'].worldPosition scene.objects['Book_page_tech'].worldPosition = scene.objects['Book'].worldPosition
@ -326,7 +409,6 @@ def chapter(cont):
for i in range(len(tech_card)): for i in range(len(tech_card)):
scene.objects[tech_card[i]+"-colbox"].restorePhysics() scene.objects[tech_card[i]+"-colbox"].restorePhysics()
# Afficher la page Speel # Afficher la page Speel
if name_chap == "Book_chap-spell": if name_chap == "Book_chap-spell":
scene.objects['Book_page_spell'].worldPosition = scene.objects['Book'].worldPosition scene.objects['Book_page_spell'].worldPosition = scene.objects['Book'].worldPosition
@ -353,8 +435,8 @@ def card (cont):
scene.objects[name_fct].color = color_doc_activate scene.objects[name_fct].color = color_doc_activate
# Afficher le texte de la fonction # Afficher le texte de la fonction
print ("name_fct : ", name_fct) # print ("name_fct : ", name_fct)
print ("fct_description : ", fct_description) # print ("fct_description : ", fct_description)
scene.objects['Book_text_title']['Text'] = fct_description[name_fct][0] scene.objects['Book_text_title']['Text'] = fct_description[name_fct][0]
scene.objects['Book_text']['Text'] = fct_description[name_fct][1] scene.objects['Book_text']['Text'] = fct_description[name_fct][1]
scene.objects['Book_text_title'].setVisible(True, False) scene.objects['Book_text_title'].setVisible(True, False)

View File

@ -391,8 +391,9 @@ def ct_build_details(x,y, cat='Archer tower', tower_name="Tower", color=tower_pu
tour['target_past']=[] tour['target_past']=[]
# Capteur Near # Capteur Near
tour.sensors['Near'].distance=tour['range'] tour.sensors['Near'].distance=tour['range']*2.5 # Range : 1 point = 2,5
tour.sensors['Near'].skippedTicks =round(1/(tour['speed']*scene.objects['Terrain']['speed'])) # tour.sensors['Near'].skippedTicks =round(1/(tour['speed']*scene.objects['Terrain']['speed']))
tour.sensors['Near'].skippedTicks =round(tour['speed']*50*scene.objects['Terrain']['speed']) # Speed : 1 point = 50 tics
# Déblocage des autres threads après la construction # Déblocage des autres threads après la construction
scene.objects['Terrain']['thread_cmd_lock'] = False scene.objects['Terrain']['thread_cmd_lock'] = False
@ -428,7 +429,7 @@ def ct_add_tower_bullet(x, y, num, cat="Ball"):
bullet['activated']=False bullet['activated']=False
## ##
# Création des sort # Création des sorts
## ##
def ct_add_tower_cast(x, y): def ct_add_tower_cast(x, y):
@ -519,7 +520,7 @@ def scn_tower_near(cont):
sound_play(sndbuff_mage) sound_play(sndbuff_mage)
# Ligne (drawLine) (vitesse rapide) # Ligne (drawLine) (vitesse rapide)
if scene.objects['Terrain']['speed']<10: # Pas d'animation à 10 -> plantage if scene.objects['Terrain']['speed']<4: # Pas d'animation à 10 -> plantage
# Archer (tir de flêche) # Archer (tir de flêche)
if obj['cat']=="Archer tower": if obj['cat']=="Archer tower":
@ -553,7 +554,7 @@ def scn_tower_near(cont):
# scene.objects['Terrain']['draw2d_list'].append([5, "ray", [obj.worldPosition.x, obj.worldPosition.y, obj.worldPosition.z+0.8], target.name, angle3, ray_yellow,5]) # Suivi du minion # scene.objects['Terrain']['draw2d_list'].append([5, "ray", [obj.worldPosition.x, obj.worldPosition.y, obj.worldPosition.z+0.8], target.name, angle3, ray_yellow,5]) # Suivi du minion
# Dégats : pas d'animation à 10 # Dégats : pas d'animation à 10
if scene.objects['Terrain']['speed']==10: if scene.objects['Terrain']['speed'] >= 4:
target['hp'] = target['hp'] - obj['damage'] target['hp'] = target['hp'] - obj['damage']
if target['hp']<=0: if target['hp']<=0:
target['dead']=True target['dead']=True

View File

@ -192,6 +192,10 @@ def wave4():
def tower_definition(): def tower_definition():
# Tower caracteristics : category (class), damage, speed, range # Tower caracteristics : category (class), damage, speed, range
# Damage : 1 point = 1 point
# Speed : 1 point = 50 tics
# Range : 1 point = 2,5 m
tower_carac={ tower_carac={
'Archer tower' : ["Archer tower", 1.0 , 0.02, 2.5], 'Archer tower' : ["Archer tower", 1.0 , 0.02, 2.5],
'Mage tower' : ["Mage tower", 0.0 , 0.005, 2.5], 'Mage tower' : ["Mage tower", 0.0 , 0.005, 2.5],