Merge remote-tracking branch 'origin/wave' into boss-fight
This commit is contained in:
commit
889dd62bdf
|
@ -110,6 +110,33 @@ class LifeBar:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
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):
|
def __initialize_world(world: World):
|
||||||
"""
|
"""
|
||||||
TODO
|
TODO
|
||||||
|
@ -120,9 +147,10 @@ def __initialize_world(world: World):
|
||||||
Life(100),
|
Life(100),
|
||||||
Hurtable.TRUE,
|
Hurtable.TRUE,
|
||||||
IsRunning(),
|
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")))
|
world.new_entity().set(Sprite(world[Assets].get_texture("background")))
|
||||||
|
|
||||||
|
@ -265,6 +293,30 @@ def __defeat(world: World):
|
||||||
world[CurrentScene] = __new_game_scene()
|
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):
|
def __create_zone_attack(world: World):
|
||||||
"""
|
"""
|
||||||
TODO
|
TODO
|
||||||
|
@ -352,7 +404,7 @@ def __create_zone_attack(world: World):
|
||||||
locate = locate2
|
locate = locate2
|
||||||
|
|
||||||
|
|
||||||
def __create_spike(world: World, time: float):
|
def __create_spike(world: World):
|
||||||
"""
|
"""
|
||||||
TODO
|
TODO
|
||||||
"""
|
"""
|
||||||
|
@ -445,7 +497,7 @@ def __create_spike(world: World, time: float):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
yield wait(time)
|
yield wait(5)
|
||||||
|
|
||||||
for spike in world.query(Spike):
|
for spike in world.query(Spike):
|
||||||
match spike.get(Spike):
|
match spike.get(Spike):
|
||||||
|
@ -494,9 +546,9 @@ def __rainning_projectiles(world: World):
|
||||||
yield wait(0.2)
|
yield wait(0.2)
|
||||||
entity.set(smooth.Target(Vec2(entity[Sprite].position.x, 1121)))
|
entity.set(smooth.Target(Vec2(entity[Sprite].position.x, 1121)))
|
||||||
|
|
||||||
for entity in world.query(RainProjectiles, Sprite):
|
for entity in world.query(RainProjectiles, Sprite):
|
||||||
if entity[Sprite].position.y > 1080:
|
if entity[Sprite].position.y > 1080:
|
||||||
entity.destroy()
|
entity.destroy()
|
||||||
|
|
||||||
|
|
||||||
def __check_key_pressed(world: World):
|
def __check_key_pressed(world: World):
|
||||||
|
|
Loading…
Reference in a new issue