Put kills into the pool

This commit is contained in:
Philippe Roy 2022-07-21 00:13:52 +02:00
parent 78213d448a
commit 3f54e0a1ab
6 changed files with 740 additions and 728 deletions

View File

@ -1,43 +1,22 @@
# CodeTower
**Code your tower ! (coding tower defense)**
**Code your tower (coding tower defense)**
CodeTower is a Tower Defense coding game where the towers are driven by Python code.
**Stop the minions waves with your favorite editing software !**
* [Screencast](http://www.phroy.org/cloud/index.php/s/djBtGFSXBfCFJM7)
[![CodeTower - Gameplay](img/screen-04-ytb.png)](https://www.youtube.com/watch?v=snZaTSre8FA "CodeTower - Gameplay")
It's a early prototype. CodeTower is a open source software distributed under the terms of the [GPLv3 license]('https://www.gnu.org/licenses/gpl-3.0.html').
The game engine is [Blender](https://blender.org) / [UPGE](https://upbge.org).
It's a early prototype.
CodeTower is a open source software distributed under the terms of the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.html).
The game engine is open source : [Blender](https://blender.org) / [UPBGE](https://upbge.org).
Assets (3D models, sounds, icons) : [Kenney]( https://www.kenney.nl/ ) and [Kaylousberg](https://www.kaylousberg.com).
![Screenshot](img/screenshot-01.jpg)
### Download
* itch.io : [itch.io / codetower](https://phroy.itch.io/codetower)
Source repository (Gitlab) : https://gitlab.com/phroy/codetower
* Source repository (Gitlab) : https://gitlab.com/phroy/codetower
* Binaries repository (GNU/Linux and Windows) : [www.phroy.org](http://www.phroy.org/cloud/index.php/s/nyoWT6xMkxAJ9Pm)
### Python script
The Python script is the file **"ct_cmd.py"** (in the game folder), you have to edit it with your favorite editing software (Spyder, Emacs, Atom, ...).
### Map commands
The level points will be spent for build or upgrade. So you have to know your level before action.
* **Get your level : ct_level ()**
- Return your level (integer)
* **Time management (temporization) : ct_sleep (delay)**
- delay : duration in seconds (float)
Binaries (GNU/Linux and Windows) : [www.phroy.org](http://www.phroy.org/cloud/index.php/s/nyoWT6xMkxAJ9Pm)
### Tower commands
@ -45,6 +24,8 @@ With your Python script, you can build, remove and upgrade your towers.
For each tower, you will be able to choose dynamically most appropriate techno (archer tower) or spell (mage tower).
The Python script is the file **ct_cmd.py** (in the game folder), you have to edit it with editing software (Spyder, Emacs, Atom, ...).
* **Build a tower : ct_build (x, y, category, name, color, style)**
- x position (integer)
- y position (integer)
@ -60,3 +41,9 @@ For each tower, you will be able to choose dynamically most appropriate techno (
* **Remove a tower : ct_remove (x, y)**
- x position (integer)
- y position (integer)
* **Get your level : ct_level ()**
- Return your level (integer)
* **Time management (temporization) : ct_sleep (delay)**
- delay : duration in seconds (float)

1364
UML.xmi

File diff suppressed because it is too large Load Diff

Binary file not shown.

7
ct.py
View File

@ -225,6 +225,11 @@ def points_maj (cont):
if scene.objects['Terrain']['thread_wave']==False and scene.objects['Terrain']['map_run'] == True :
if scene.objects['Points']['minions_run']==0 :
# Suppression des minions
for obj_i in scene.objects:
if "type_minion" in obj_i.getPropertyNames():
obj_i.endObject()
# Fin ou vague suivante
if scene.objects['Points']['lifes'] == 0 or scene.objects['Points']['wave'] == scene.objects['Terrain']['nb_waves'] :
terrain_end ()
@ -406,7 +411,7 @@ def terrain_stop ():
runpy.run_module('ct_cmd', run_name='stop') # Stop du script utilisateur
ct_map.stop() # Stop du script des vagues
# Supprimer les enemis
# Suppression des minions
for obj_i in scene.objects:
if "type_minion" in obj_i.getPropertyNames():
obj_i.endObject()

View File

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

View File

@ -263,7 +263,9 @@ def scn_minion_dead(cont):
scene.objects['Points']['minions_run'] -=1
scene.objects['Points']['kills'] +=1
scene.objects['Points']['coins']= scene.objects['Points']['coins']+obj['bounty']
obj.endObject()
obj.setVisible(False)
obj.suspendPhysics (True)
# obj.endObject()
###############################################################################
# Spells / Casts
@ -581,7 +583,9 @@ def scn_map_end_near(cont):
scene.objects['Points']['lifes']= scene.objects['Points']['lifes']-obj_i['lifes_damage']
scene.objects['Points']['minions_run'] -=1
for obj_i in sensor.hitObjectList :
obj_i.endObject()
obj_i.setVisible(False)
obj_i.suspendPhysics (True)
# obj_i.endObject()
##
# Drapeau de fin