mirror of
https://forge.apps.education.fr/phroy/codetower.git
synced 2024-01-27 11:35:17 +01:00
ajout du paysage
This commit is contained in:
parent
f9f0977e78
commit
974b3abc21
49
ct_map.py
49
ct_map.py
@ -1,49 +0,0 @@
|
||||
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
||||
from ct_lib import * # Bibliothèque CodeTower
|
||||
|
||||
###############################################################################
|
||||
# ct_map.py
|
||||
# @title: Map definition
|
||||
# @project: CodeTower
|
||||
# @lang: fr,en
|
||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
||||
# @copyright: Copyright (C) 2022 Philippe Roy
|
||||
# @license: GNU GPL
|
||||
#
|
||||
# This game is a tower defense coding game. The towers are driven with Python code.
|
||||
#
|
||||
# The file is the the waves definition
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
scene = bge.logic.getCurrentScene()
|
||||
|
||||
###############################################################################
|
||||
# Carte 1
|
||||
###############################################################################
|
||||
|
||||
# Loading the map
|
||||
def map1_init():
|
||||
|
||||
# Taille de la carte
|
||||
scene.objects['Terrain']['taille'] = [-15,15,-10,10]
|
||||
|
||||
# Navmesh
|
||||
scene.objects['Terrain']['navmesh'] = "Navmesh.004"
|
||||
|
||||
# Ajout des sorties
|
||||
scene.objects['Terrain']['endtile'] = "tile_straight.036"
|
||||
ct_map_end(1,-10)
|
||||
ct_map_endflag(0.5,-10)
|
||||
ct_map_endflag(1.5,-10)
|
||||
|
||||
# Reset counters
|
||||
def map1_reset():
|
||||
scene.objects['Points']['lifes']=10
|
||||
scene.objects['Points']['lifes_max']=10
|
||||
scene.objects['Points']['coins']=0
|
||||
scene.objects['Points']['level']=0
|
||||
scene.objects['Points']['level_max']=1
|
||||
scene.objects['Points']['minions']=0
|
||||
scene.objects['Points']['minions_run']=0
|
||||
|
103
ct_waves.py
103
ct_waves.py
@ -1,103 +0,0 @@
|
||||
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
||||
from ct_lib import * # Bibliothèque CodeTower
|
||||
|
||||
###############################################################################
|
||||
# ct_waves.py
|
||||
# @title: Waves for the CodeTower game
|
||||
# @project: CodeTower
|
||||
# @lang: fr,en
|
||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
||||
# @copyright: Copyright (C) 2022 Philippe Roy
|
||||
# @license: GNU GPL
|
||||
#
|
||||
# This game is a tower defense coding game. The towers are driven with Python code.
|
||||
#
|
||||
# The file is the the waves definition
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# En: Threads management << DONT CHANGE THIS SECTION >>
|
||||
# Fr: Gestion des tâches (threads) << NE PAS MODIFIER CETTE SECTION >>
|
||||
###############################################################################
|
||||
|
||||
threads=[]
|
||||
scene = bge.logic.getCurrentScene()
|
||||
|
||||
def start():
|
||||
scene.objects['Terrain']['thread_wave']=True
|
||||
thread_start(threads, "waves", waves)
|
||||
|
||||
def stop():
|
||||
if thread_stop(threads, "waves"):
|
||||
if len(threads)==1:
|
||||
threads.pop()
|
||||
|
||||
###############################################################################
|
||||
# En: Waves commands
|
||||
# Fr: Commandes des vagues
|
||||
#
|
||||
# Spawn a minion : ct_minion (x, y, cat, level)
|
||||
# - x spwan position (integer)
|
||||
# - y spwan position (integer)
|
||||
# - cat : minion class (string) :
|
||||
# - Knight
|
||||
# - Barbarian
|
||||
# - Warrior
|
||||
# - Mage
|
||||
# - Rogue
|
||||
# - Orc
|
||||
# - Squelette
|
||||
# - level (1, 2 or 3)
|
||||
#
|
||||
# Time management (temporization) : ct_tempo(delay)
|
||||
# - delay : delay in seconds (integer)
|
||||
#
|
||||
# UI management : ct_map_text(text)
|
||||
# - text for the wave label
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# Minion caracteristics : category (class), level, hp, speed, armor, bounty, lifes_damage
|
||||
|
||||
# minion_carac={
|
||||
# 'Knight-lv1' : ["Knight", 1 , 2.0, 1.0, 0.0, 5,1],
|
||||
# 'Knight-lv2' : ["Knight", 2, 4.0, 1.0, 1.0, 20,1],
|
||||
# 'Knight-lv3' : ["Knight", 3, 8.0, 1.0, 2.0, 80,1],
|
||||
# 'Orc-lv1' : ["Orc", 1 , 2.0, 1.0, 0.0, 5,1],
|
||||
# 'Orc-lv2' : ["Orc", 2, 4.0, 1.0, 1.0, 20,1],
|
||||
# 'Orc-lv3' : ["Orc", 3, 8.0, 1.0, 2.0, 80,1]}
|
||||
|
||||
# minion_3d={
|
||||
# 'Knight-lv1' : [['Knight_m', 'Knight_f', 'OldKnight_m'],['A','B','C','D'],['common']],
|
||||
# 'Knight-lv2' : [['Knight_m', 'Knight_f', 'OldKnight_m'],['A','B','C','D'],['uncommon']],
|
||||
# 'Knight-lv3' : [['Knight_m', 'Knight_f', 'OldKnight_m'],['A','B','C','D'],['rare']],
|
||||
# 'Orc-lv1' : [['Orc'],['A','B','C','D','E','F'],['common']],
|
||||
# 'Orc-lv2' : [['Orc'],['A','B','C','D','E','F'],['uncommon']],
|
||||
# 'Orc-lv3' : [['Orc'],['A','B','C','D','E','F'],['rare']]}
|
||||
|
||||
def waves():
|
||||
|
||||
# Wave 1
|
||||
scene.objects['Points']['wave']= 1
|
||||
ct_map_text("Wave 1")
|
||||
for i in range (15):
|
||||
ct_minion(14,3,"Orc",1)
|
||||
ct_sleep (1)
|
||||
|
||||
# ct_sleep (20)
|
||||
|
||||
# Wave 2
|
||||
# scene.objects['Points']['wave']= 2
|
||||
# ct_map_text("Wave 2")
|
||||
# for i in range (20):
|
||||
# # ct_minion(14,3,"Knight",1)
|
||||
# # ct_minion(14,3,"Orc",1)
|
||||
# ct_minion_details(14,3,"Knight",1, "OldKnight_m_A_common")
|
||||
# ct_sleep (1)
|
||||
|
||||
ct_sleep (2)
|
||||
print ("Threads waves #", len(threads)-1, "are arrived -> close them.") # Thread closed << DONT CHANGE THIS LINE >>
|
||||
threads.pop()
|
||||
scene.objects['Terrain']['thread_wave']=False # End of cycle << DONT CHANGE THIS LINE >>
|
Loading…
x
Reference in New Issue
Block a user