diff --git a/asset/icons/book/spell/aura.svg b/asset/icons/book/spell/aura.svg
new file mode 100644
index 0000000..f6566a9
--- /dev/null
+++ b/asset/icons/book/spell/aura.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/spell/deadly-strike.svg b/asset/icons/book/spell/deadly-strike.svg
new file mode 100644
index 0000000..58f7d50
--- /dev/null
+++ b/asset/icons/book/spell/deadly-strike.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/spell/dread.svg b/asset/icons/book/spell/dread.svg
new file mode 100644
index 0000000..c7e5689
--- /dev/null
+++ b/asset/icons/book/spell/dread.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/spell/enrage.svg b/asset/icons/book/spell/enrage.svg
new file mode 100644
index 0000000..6c6a093
--- /dev/null
+++ b/asset/icons/book/spell/enrage.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/spell/extra-lucid.svg b/asset/icons/book/spell/extra-lucid.svg
new file mode 100644
index 0000000..9e84702
--- /dev/null
+++ b/asset/icons/book/spell/extra-lucid.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/spell/mighty-force.svg b/asset/icons/book/spell/mighty-force.svg
new file mode 100644
index 0000000..b716b18
--- /dev/null
+++ b/asset/icons/book/spell/mighty-force.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/spell/wisdom.svg b/asset/icons/book/spell/wisdom.svg
new file mode 100644
index 0000000..888e945
--- /dev/null
+++ b/asset/icons/book/spell/wisdom.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/tower/dark-squad.svg b/asset/icons/book/tower/dark-squad.svg
new file mode 100644
index 0000000..d4897cb
--- /dev/null
+++ b/asset/icons/book/tower/dark-squad.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/tower/eye-target.svg b/asset/icons/book/tower/eye-target.svg
new file mode 100644
index 0000000..6256b33
--- /dev/null
+++ b/asset/icons/book/tower/eye-target.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/tower/night-sleep.svg b/asset/icons/book/tower/night-sleep.svg
new file mode 100644
index 0000000..42b9686
--- /dev/null
+++ b/asset/icons/book/tower/night-sleep.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/tower/spanner.svg b/asset/icons/book/tower/spanner.svg
new file mode 100644
index 0000000..cf50dfc
--- /dev/null
+++ b/asset/icons/book/tower/spanner.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/asset/icons/book/tower/upgrade.svg b/asset/icons/book/tower/upgrade.svg
new file mode 100644
index 0000000..817af78
--- /dev/null
+++ b/asset/icons/book/tower/upgrade.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/codetower-36.blend b/codetower-36.blend
index aa48dbd..199107b 100644
Binary files a/codetower-36.blend and b/codetower-36.blend differ
diff --git a/ct_doc.py b/ct_doc.py
index 3f7a3e6..3b0ea09 100644
--- a/ct_doc.py
+++ b/ct_doc.py
@@ -40,28 +40,30 @@ JUST_RELEASED = bge.logic.KX_INPUT_JUST_RELEASED
ACTIVATE = bge.logic.KX_INPUT_ACTIVE
# JUST_DEACTIVATED = bge.logic.KX_SENSOR_JUST_DEACTIVATED
+# Functions description
+fct_description ={}
+
###############################################################################
# Map
###############################################################################
-map_fct=["ct_level", "ct_sleep"]
+map_card=["Level-card", "Sleep-card"]
# ct_level ()
ct_level_title="Get your level"
ct_level_text=" ct_level ()\n \v - Return your level (integer)"
+fct_description.update({"Level-card" : [ct_level_title, ct_level_text]})
# ct_sleep (delay)
ct_sleep_title="Time management"
ct_sleep_text=" ct_sleep (delay)\n \v - delay : duration in seconds (float)"
-
-map_fct_title=[ct_level_title, ct_sleep_title]
-map_fct_text=[ct_level_text, ct_sleep_text]
+fct_description.update({"Sleep-card" : [ct_sleep_title, ct_sleep_text]})
###############################################################################
# Tower
###############################################################################
-tower_fct=["ct_build", "ct_remove"]
+tower_card=["Build-card", "Remove-card", "Upgrade-card", "Activate-card", "Tune-card", "Targets-card"]
# ct_build (x, y, category, name, color, style)
ct_build_title="Build a tower"
@@ -72,54 +74,103 @@ ct_build_text = ct_build_text +" \v- style (string) : \n \v \v- \"square\" (defa
ct_build_text = ct_build_text +" \v- Return boolean flag (builded -> True)\n\n"
ct_build_text = ct_build_text +"Predefined colors : blue, green, magenta,\n orange, purple, red, turquoise, yellow.\n\n"
ct_build_text = ct_build_text +"Exemple : ct_build (1, 1, \"Archer tower\", \n \"Tower #1\", yellow, \"round-A\")\n"
+fct_description.update({"Build-card" : [ct_build_title, ct_build_text]})
# ct_remove (x, y)
ct_remove_title="Remove a tower"
ct_remove_text=" ct_remove (x, y) \n \v - x position (integer)\n \v - y position (integer)\n"
+fct_description.update({"Remove-card" : [ct_remove_title, ct_remove_text]})
-tower_fct_title=[ct_build_title, ct_remove_title]
-tower_fct_text=[ct_build_text, ct_remove_text]
+# ct_upgrade (x, y)
+ct_upgrade_title="Upgrade a tower"
+ct_upgrade_text=" ct_upgrade (x, y) \n \v - x position (integer)\n \v - y position (integer)\n"
+ct_upgrade_text = ct_upgrade_text +"FIXME\n"
+fct_description.update({"Upgrade-card" : [ct_upgrade_title, ct_upgrade_text]})
+
+# ct_activate (x, y)
+ct_activate_title="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"
+fct_description.update({"Activate-card" : [ct_activate_title, ct_activate_text]})
+
+# ct_tune (x, y)
+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_text +"FIXME\n"
+fct_description.update({"Tune-card" : [ct_tune_title, ct_tune_text]})
+
+# ct_targets (x, y)
+ct_targets_title="FIXME"
+ct_targets_text=" ct_targets (x, y) \n \v - x position (integer)\n \v - y position (integer)\n"
+ct_targets_text = ct_targets_text +"FIXME\n"
+fct_description.update({"Targets-card" : [ct_targets_title, ct_targets_text]})
###############################################################################
# Tech
###############################################################################
-tech_fct=[]
-tech_fct_title=[]
-tech_fct_text=[]
+tech_card=["Accurate-card", "Volley-card", "Slow_tech-card", "Fire-card", "Bolt-card", "Ice-card", "Acid-card"]
+
+# ct_accurate
+ct_accurate_title="FIXME"
+ct_accurate_text="FIXME\n"
+fct_description.update({"Accurate-card" : [ct_accurate_title, ct_accurate_text]})
+
+# ct_volley
+ct_volley_title="FIXME"
+ct_volley_text="FIXME\n"
+fct_description.update({"Volley-card" : [ct_volley_title, ct_volley_text]})
+
+# ct_slow_tech
+ct_slow_tech_title="FIXME"
+ct_slow_tech_text="FIXME\n"
+fct_description.update({"Slow_tech-card" : [ct_slow_tech_title, ct_slow_tech_text]})
+
+# ct_fire
+ct_fire_title="FIXME"
+ct_fire_text="FIXME\n"
+fct_description.update({"Fire-card" : [ct_fire_title, ct_fire_text]})
+
+# ct_bolt
+ct_bolt_title="FIXME"
+ct_bolt_text="FIXME\n"
+fct_description.update({"Bolt-card" : [ct_bolt_title, ct_bolt_text]})
+
+# ct_ice
+ct_ice_title="FIXME"
+ct_ice_text="FIXME\n"
+fct_description.update({"Ice-card" : [ct_ice_title, ct_ice_text]})
+
+# ct_acid
+ct_acid_title="FIXME"
+ct_acid_text="FIXME\n"
+fct_description.update({"Acid-card" : [ct_acid_title, ct_acid_text]})
###############################################################################
# Spell
###############################################################################
-spell_fct=[]
-spell_fct_title=[]
-spell_fct_text=[]
+spell_card=["Slow_spell-card", "Detect-card", "Fear-card", "Aura-card"]
-###############################################################################
-# General
-###############################################################################
+# ct_slow_spell
+ct_slow_spell_title="FIXME"
+ct_slow_spell_text="FIXME\n"
+fct_description.update({"Slow_spell-card" : [ct_slow_spell_title, ct_slow_spell_text]})
-fct = {
- 'Book_chap-screen': "",
- 'Book_chap-map' : map_fct,
- 'Book_chap-tower' : tower_fct,
- 'Book_chap-tech' : tech_fct,
- 'Book_chap-spell' : spell_fct}
+# ct_detect
+ct_detect_title="FIXME"
+ct_detect_text="FIXME\n"
+fct_description.update({"Detect-card" : [ct_detect_title, ct_detect_text]})
-fct_title = {
- 'Book_chap-screen': "",
- 'Book_chap-map' : map_fct_title,
- 'Book_chap-tower' : tower_fct_title,
- 'Book_chap-tech' : tech_fct_title,
- 'Book_chap-spell' : spell_fct_title}
+# ct_fear
+ct_fear_title="FIXME"
+ct_fear_text="FIXME\n"
+fct_description.update({"Fear-card" : [ct_fear_title, ct_fear_text]})
+
+# ct_aura
+ct_aura_title="FIXME"
+ct_aura_text="FIXME\n"
+fct_description.update({"Aura-card" : [ct_aura_title, ct_aura_text]})
-fct_text = {
- 'Book_chap-screen': "",
- 'Book_chap-map' : map_fct_text,
- 'Book_chap-tower' : tower_fct_text,
- 'Book_chap-tech' : tech_fct_text,
- 'Book_chap-spell' : spell_fct_text}
###############################################################################
# Interface
@@ -131,7 +182,7 @@ fct_text = {
def init():
- # Book
+ # 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_chap-screen'].color = color_doc_chap
@@ -141,25 +192,31 @@ def init():
scene.objects['Book_chap-spell'].color = color_doc_chap
scene.objects['Book_close'].color = color_doc_chap
scene.objects['Book'].setVisible(True,True)
- sound_play (sndbuff_book_open)
-
- # Tout effacer
- for i in range (1,13):
- if i<10:
- name_fct = "Book_fct-0"+str(i)
- else:
- name_fct = "Book_fct-"+str(i)
- scene.objects[name_fct].setVisible(False,False)
- scene.objects[name_fct].color = color_doc_fct
scene.objects['Book_text_title'].setVisible(False,True)
scene.objects['Book_text'].setVisible(False,True)
+ sound_play (sndbuff_book_open)
- # Activer la page screen
+ # 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
##
@@ -167,19 +224,18 @@ def init():
def close():
sound_play (sndbuff_book_close)
+ # Effacer les fonctions cartes
+ scene.objects['Book_page_screen'].setVisible(False,True)
+ scene.objects['Book_page_map'].setVisible(False,True)
+ scene.objects['Book_page_tower'].setVisible(False,True)
+ scene.objects['Book_page_tech'].setVisible(False,True)
+ scene.objects['Book_page_spell'].setVisible(False,True)
+
scene.objects['Book_page_screen'].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, 15, 14] # Position dans Blender [28, 0.84549, 1.53626]
scene.objects['Book_page_screen'].worldPosition = scene.objects['Book'].worldPosition
-
-
- # scene.objects['Book_page_screen'].setVisible(False,True)
- # scene.objects['Book_page_map'].setVisible(False,True)
- # scene.objects['Book_page_map-canvas'].setVisible(False,True)
- # scene.objects['Book_page_tower-canvas'].setVisible(False,True)
- # scene.objects['Book_page_tech-canvas'].setVisible(False,True)
- # scene.objects['Book_page_spell-canvas'].setVisible(False,True)
##
# Highlight du livre
@@ -213,92 +269,71 @@ def chapter(cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and cont.sensors['Click'].positive:
sound_play (sndbuff_book_flip)
obj = cont.owner
- name_chap=obj.name[:-7]
-
- # Highlight des onglets
- 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
+ last_name_chap= scene.objects['Book']['page_chap']
+ name_chap= obj.name[:-7]
+ scene.objects[last_name_chap].color = color_doc_chap
scene.objects[name_chap].color = color_doc_activate
- scene.objects["Book"]['page_chap'] = name_chap
-
- # Tout effacer (fonctions + texte)
- for i in range (1,13):
- if i<10:
- name_fct = "Book_fct-0"+str(i)
- else:
- name_fct = "Book_fct-"+str(i)
- scene.objects[name_fct].setVisible(False,False)
- scene.objects[name_fct].color = color_doc_fct
- scene.objects["Book"]['page_fct'] = ""
+ scene.objects['Book']['page_chap'] = name_chap
+ last_name_fct= scene.objects['Book']['page_fct']
+ if last_name_fct != "":
+ scene.objects[last_name_fct].color = color_doc_fct
+ scene.objects['Book']['page_fct'] = ""
scene.objects['Book_text_title'].setVisible(False,True)
scene.objects['Book_text'].setVisible(False,True)
+ # Effacer les fonctions cartes
scene.objects['Book_page_screen'].setVisible(False,True)
scene.objects['Book_page_map'].setVisible(False,True)
- scene.objects['Book_page_map-canvas'].setVisible(False,True)
- scene.objects['Book_page_tower-canvas'].setVisible(False,True)
- scene.objects['Book_page_tech-canvas'].setVisible(False,True)
- scene.objects['Book_page_spell-canvas'].setVisible(False,True)
+ scene.objects['Book_page_tower'].setVisible(False,True)
+ scene.objects['Book_page_tech'].setVisible(False,True)
+ scene.objects['Book_page_spell'].setVisible(False,True)
- # Afficher la page Ecran
+ # Désactiver les cartes
+ 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()
+
+ # Afficher la page Screen
if name_chap == "Book_chap-screen":
scene.objects['Book_page_screen'].worldPosition = scene.objects['Book'].worldPosition
scene.objects['Book_page_screen'].setVisible(True,True)
- # Afficher les fonctions
- if name_chap != "Book_chap-screen":
- # scene.objects['Book_page_screen'].setVisible(False,True)
+ # Afficher la page Map
+ if name_chap == "Book_chap-map":
+ scene.objects['Book_page_map'].worldPosition = scene.objects['Book'].worldPosition
+ scene.objects['Book_page_map'].setVisible(True,True)
+ for i in range(len(map_card)):
+ scene.objects[map_card[i]+"-colbox"].restorePhysics()
- # Pas de fonctions
- if len(fct[name_chap])==0:
- scene.objects['Book_text']['Text'] = " No functions yet. \n Work in progress..."
- scene.objects['Book_text'].setVisible(True,True)
- # Cartes des fonctions Map
- if name_chap == "Book_chap-map":
- scene.objects['Book_page_map-canvas'].worldPosition = scene.objects['Book'].worldPosition
- scene.objects['Book_page_map-canvas'].setVisible(True,True)
+ # Afficher la page Tower
+ if name_chap == "Book_chap-tower":
+ scene.objects['Book_page_tower'].worldPosition = scene.objects['Book'].worldPosition
+ scene.objects['Book_page_tower'].setVisible(True,True)
+ for i in range(len(tower_card)):
+ scene.objects[tower_card[i]+"-colbox"].restorePhysics()
- # Autres fonctions
- else:
- for i in range(len(fct[name_chap])):
- j=i+1
- if j<10:
- name_fct = "Book_fct-0"+str(j)
- else:
- name_fct = "Book_fct-"+str(j)
- scene.objects[name_fct]['Text']=fct[name_chap][i]
- scene.objects[name_fct].setVisible(True,False)
-##
-# Afficher les details de la fonction
-##
+ # Afficher la page Tech
+ if name_chap == "Book_chap-tech":
+ scene.objects['Book_page_tech'].worldPosition = scene.objects['Book'].worldPosition
+ scene.objects['Book_page_tech'].setVisible(True,True)
+ for i in range(len(tech_card)):
+ scene.objects[tech_card[i]+"-colbox"].restorePhysics()
-def function(cont):
- if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
- sound_play (sndbuff_book_flip)
- obj = cont.owner
- # Highlight des fonctions
- for i in range (1,13):
- if i<10:
- name_fct = "Book_fct-0"+str(i)
- else:
- name_fct = "Book_fct-"+str(i)
- scene.objects[name_fct].color = color_doc_fct
- scene.objects[obj.name[:-7]].color = color_doc_activate
- scene.objects["Book"]['page_fct'] = obj.name[:-7]
+ # Afficher la page Speel
+ if name_chap == "Book_chap-spell":
+ scene.objects['Book_page_spell'].worldPosition = scene.objects['Book'].worldPosition
+ scene.objects['Book_page_spell'].setVisible(True,True)
+ for i in range(len(spell_card)):
+ scene.objects[spell_card[i]+"-colbox"].restorePhysics()
- # Afficher le texte de la fonction
- name_chap = scene.objects["Book"]['page_chap']
- nb = int(obj.name[9:11])-1
- scene.objects['Book_text_title']['Text'] = fct_title[name_chap][nb]
- scene.objects['Book_text']['Text'] = fct_text[name_chap][nb]
- scene.objects['Book_text_title'].setVisible(True,True)
- scene.objects['Book_text'].setVisible(True,False)
##
# Afficher les details de la fonction à partir d'une carte
@@ -309,23 +344,21 @@ def card (cont):
sound_play (sndbuff_book_flip)
obj = cont.owner
- # Highlight des fonctions
- # for i in range (1,13):
- # if i<10:
- # name_fct = "Book_fct-0"+str(i)
- # else:
- # name_fct = "Book_fct-"+str(i)
- # scene.objects[name_fct].color = color_doc_fct
- # scene.objects[obj.name[:-7]].color = color_doc_activate
- # scene.objects["Book"]['page_fct'] = obj.name[:-7]
+ # Highlight des cartes
+ last_name_fct= scene.objects['Book']['page_fct']
+ name_fct= obj.name[:-7]
+ if last_name_fct != "":
+ scene.objects[last_name_fct].color = color_doc_fct
+ scene.objects['Book']['page_fct'] = name_fct
+ scene.objects[name_fct].color = color_doc_activate
# Afficher le texte de la fonction
- # name_chap = scene.objects["Book"]['page_chap']
- # nb = int(obj.name[9:11])-1
- # scene.objects['Book_text_title']['Text'] = fct_title[name_chap][nb]
- # scene.objects['Book_text']['Text'] = fct_text[name_chap][nb]
- # scene.objects['Book_text_title'].setVisible(True,True)
- # scene.objects['Book_text'].setVisible(True,False)
+ print ("name_fct : ", name_fct)
+ print ("fct_description : ", fct_description)
+ 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_title'].setVisible(True, False)
+ scene.objects['Book_text'].setVisible(True, False)
##
# Sounds
diff --git a/ct_map1.py b/ct_map1.py
index f3a2c56..d8b867f 100644
--- a/ct_map1.py
+++ b/ct_map1.py
@@ -126,10 +126,13 @@ def minion_definition():
# Wave 1
def wave1():
+ # Text
ct_map_text_wave(1)
+ # Pooling
wave_minion_name=[]
for i in range (15):
wave_minion_name.append(ct_minion_create_details(14,3,"Orc",1, "Orc_A_common"))
+ # Go !
for i in range (len(wave_minion_name)):
ct_minion_go(wave_minion_name[i])
ct_sleep (2)
@@ -137,10 +140,13 @@ def wave1():
# Wave 2
def wave2():
+ # Text
ct_map_text_wave(2)
+ # Pooling
wave_minion_name=[]
for i in range (20):
wave_minion_name.append(ct_minion_create(14,3,"Orc",1))
+ # Go !
for i in range (len(wave_minion_name)):
ct_minion_go(wave_minion_name[i])
ct_sleep (1)
@@ -148,10 +154,13 @@ def wave2():
# Wave 3
def wave3():
+ # Text
ct_map_text_wave(3)
+ # Pooling
wave_minion_name=[]
for i in range (30):
wave_minion_name.append(ct_minion_create(14,3,"Orc",1))
+ # Go !
for i in range (len(wave_minion_name)):
ct_minion_go(wave_minion_name[i])
ct_sleep (1)
@@ -159,12 +168,15 @@ def wave3():
# Wave 4
def wave4():
+ # Text
ct_map_text_wave(4)
+ # Pooling
wave_minion_name_group1=[]
wave_minion_name_group2=[]
for i in range (20):
wave_minion_name_group1.append(ct_minion_create(14,2.5,"Orc",1))
wave_minion_name_group2.append(ct_minion_create(14,3,"Knight",1))
+ # Go !
for i in range (len(wave_minion_name_group1)):
ct_minion_go(wave_minion_name_group1[i])
ct_minion_go(wave_minion_name_group2[i])