mirror of
https://forge.apps.education.fr/phroy/codetower.git
synced 2024-01-27 11:35:17 +01:00
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
|
from ct_lib import * # Bibliothèque CodeTower
|
|
import time
|
|
|
|
###############################################################################
|
|
# ct_cmd.py
|
|
# @title: Commands for the CodeTower game
|
|
# @project: CodeTower
|
|
# @lang: fr
|
|
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
|
# @copyright: Copyright (C) 2022 Philippe Roy
|
|
# @license: GNU GPL
|
|
#
|
|
# Ce simulateur est un jeu du type tower defense où les tours sont à piloter par la programmation Python.
|
|
# This game is a tower defense coding game. The towers are driven with Python code.
|
|
#
|
|
###############################################################################
|
|
|
|
###############################################################################
|
|
# Gestion des tâches (threads) << NE PAS MODIFIER CETTE SECTION >>
|
|
###############################################################################
|
|
|
|
threads=[]
|
|
scene = bge.logic.getCurrentScene()
|
|
|
|
def start():
|
|
scene.objects['Terrain']['thread_cmd']=True
|
|
thread_start(threads, "commands", commandes)
|
|
|
|
def stop():
|
|
thread_stop(threads, "commands")
|
|
|
|
###############################################################################
|
|
# Instructions élémentaires
|
|
###############################################################################
|
|
|
|
def commandes():
|
|
|
|
# Coder vos commandes ici ...
|
|
|
|
#ct_tower(12,2)
|
|
ct_tower(4,5)
|
|
|
|
tempo(2)
|
|
print ("Threads commands #", len(threads)-1, "are arrived -> close them.") # Tâche close (thread) << NE PAS MODIFIER CETTE LIGNE >>
|
|
scene.objects['Terrain']['thread_cmd']=False # Fin du cycle << NE PAS MODIFIER CETTE LIGNE >>
|