WIP Ajout systeme de vague
This commit is contained in:
parent
7e0898d848
commit
1c5254fb8a
|
@ -102,6 +102,33 @@ class Player:
|
|||
"""
|
||||
|
||||
|
||||
class Wave:
|
||||
"""
|
||||
Ressource quid efinit les vagues du combat de boss
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.wave_list = [
|
||||
["__rainning_projectiles"],
|
||||
["__rainning_projectiles", "__rainning_projectiles"],
|
||||
["__rainning_projectiles", "__create_zone_attack"],
|
||||
[
|
||||
"__rainning_projectiles",
|
||||
"__rainning_projectiles",
|
||||
"__create_zone_attack",
|
||||
],
|
||||
["__rainning_projectiles", "__create_spike"],
|
||||
["__rainning_projectiles", "__rainning_projectiles", "__create_spike"],
|
||||
[
|
||||
"__rainning_projectiles",
|
||||
"__rainning_projectiles",
|
||||
"__create_spike",
|
||||
"__create_zone_attack",
|
||||
],
|
||||
[30.0], # Definit le temps de chaque vague
|
||||
]
|
||||
|
||||
|
||||
def __initialize_world(world: World):
|
||||
"""
|
||||
TODO
|
||||
|
@ -112,9 +139,10 @@ def __initialize_world(world: World):
|
|||
Life(100),
|
||||
Hurtable.TRUE,
|
||||
IsRunning(),
|
||||
Wave(),
|
||||
)
|
||||
|
||||
world.new_entity().set(Coroutine(__rainning_projectiles(world)))
|
||||
world.new_entity().set(Coroutine(__wave(world)))
|
||||
|
||||
world.new_entity().set(Sprite(world[Assets].get_texture("background")))
|
||||
|
||||
|
@ -240,6 +268,30 @@ def __defeat(world: World):
|
|||
world[CurrentScene] = __new_game_scene()
|
||||
|
||||
|
||||
def __wave(world: World):
|
||||
for i, actuel_wave in enumerate(world[Wave].wave_list):
|
||||
print("vague n°" + str(i))
|
||||
for fonction in actuel_wave:
|
||||
match fonction:
|
||||
case "__rainning_projectiles":
|
||||
print("1")
|
||||
entity = world.new_entity()
|
||||
entity.set(Coroutine(__rainning_projectiles(world)))
|
||||
case "__create_zone_attack":
|
||||
print("2")
|
||||
entity = world.new_entity()
|
||||
entity.set(Coroutine(__create_zone_attack(world)))
|
||||
case "__create_spike":
|
||||
entity = world.new_entity()
|
||||
entity.set(Coroutine(__create_spike(world)))
|
||||
case _:
|
||||
pass
|
||||
yield wait(float(world[Wave].wave_list[-1][0]))
|
||||
entity.destroy()
|
||||
for entities in world.query(RainProjectiles):
|
||||
entities.destroy()
|
||||
|
||||
|
||||
def __create_zone_attack(world: World):
|
||||
"""
|
||||
TODO
|
||||
|
@ -327,7 +379,7 @@ def __create_zone_attack(world: World):
|
|||
locate = locate2
|
||||
|
||||
|
||||
def __create_spike(world: World, time: float):
|
||||
def __create_spike(world: World):
|
||||
"""
|
||||
TODO
|
||||
"""
|
||||
|
@ -408,7 +460,7 @@ def __create_spike(world: World, time: float):
|
|||
),
|
||||
)
|
||||
|
||||
yield wait(time)
|
||||
yield wait(5)
|
||||
|
||||
for spike in world.query(Spike):
|
||||
match spike.get(Spike):
|
||||
|
@ -457,9 +509,9 @@ def __rainning_projectiles(world: World):
|
|||
yield wait(0.2)
|
||||
entity.set(smooth.Target(Vec2(entity[Sprite].position.x, 1121)))
|
||||
|
||||
for entity in world.query(RainProjectiles, Sprite):
|
||||
if entity[Sprite].position.y > 1080:
|
||||
entity.destroy()
|
||||
for entity in world.query(RainProjectiles, Sprite):
|
||||
if entity[Sprite].position.y > 1080:
|
||||
entity.destroy()
|
||||
|
||||
|
||||
def __check_key_pressed(world: World):
|
||||
|
|
Loading…
Reference in a new issue