fix apparition de projectiles de zone
This commit is contained in:
parent
acaf9475a5
commit
4b2b6ea89c
|
@ -117,7 +117,7 @@ class Wave:
|
|||
|
||||
def __init__(self) -> None:
|
||||
self.wave_list = [
|
||||
["__rainning_projectiles"],
|
||||
["__rainning_projectiles", "__create_zone_attack"],
|
||||
["__rainning_projectiles", "__horizontal_projectile"],
|
||||
[
|
||||
"__rainning_projectiles",
|
||||
|
@ -323,86 +323,39 @@ def __defeat(world: World):
|
|||
world[CurrentScene] = __new_game_scene()
|
||||
|
||||
|
||||
class AWave:
|
||||
"""
|
||||
TODO
|
||||
"""
|
||||
|
||||
|
||||
def __wave(world: World):
|
||||
entity = world.new_entity()
|
||||
entity2 = world.new_entity()
|
||||
entity3 = world.new_entity()
|
||||
entity4 = world.new_entity()
|
||||
entity5 = world.new_entity()
|
||||
for i, actuel_wave in enumerate(world[Wave].wave_list):
|
||||
print("vague n°" + str(i))
|
||||
for i, fonction in enumerate(actuel_wave):
|
||||
if i == 0:
|
||||
match fonction:
|
||||
case "__rainning_projectiles":
|
||||
entity.set(Coroutine(__rainning_projectiles(world)))
|
||||
world.new_entity().set(
|
||||
AWave(), Coroutine(__rainning_projectiles(world))
|
||||
)
|
||||
case "__create_zone_attack":
|
||||
for i in range(5):
|
||||
entity.set(Coroutine(__create_zone_attack(world)))
|
||||
yield wait(5)
|
||||
world.new_entity().set(
|
||||
AWave(), Coroutine(__create_zone_attack(world))
|
||||
)
|
||||
|
||||
case "__create_spike":
|
||||
entity.set(Coroutine(__create_spike(world)))
|
||||
yield wait(25)
|
||||
entity4.set(Coroutine(__create_spike(world)))
|
||||
world.new_entity().set(AWave(), Coroutine(__create_spike(world)))
|
||||
|
||||
case "__horizontal_projectile":
|
||||
entity.set(Coroutine(__horizontal_projectile(world)))
|
||||
case _:
|
||||
pass
|
||||
elif i == 1:
|
||||
match fonction:
|
||||
case "__rainning_projectiles":
|
||||
entity2.set(Coroutine(__rainning_projectiles(world)))
|
||||
case "__create_zone_attack":
|
||||
for i in range(5):
|
||||
entity2.set(Coroutine(__create_zone_attack(world)))
|
||||
yield wait(5)
|
||||
case "__create_spike":
|
||||
entity2.set(Coroutine(__create_spike(world)))
|
||||
yield wait(25)
|
||||
entity2.set(Coroutine(__create_spike(world)))
|
||||
case "__horizontal_projectile":
|
||||
entity2.set(Coroutine(__horizontal_projectile(world)))
|
||||
case _:
|
||||
pass
|
||||
elif i == 2:
|
||||
match fonction:
|
||||
case "__rainning_projectiles":
|
||||
entity3.set(Coroutine(__rainning_projectiles(world)))
|
||||
case "__create_zone_attack":
|
||||
for i in range(5):
|
||||
entity3.set(Coroutine(__create_zone_attack(world)))
|
||||
yield wait(5)
|
||||
case "__create_spike":
|
||||
entity3.set(Coroutine(__create_spike(world)))
|
||||
yield wait(25)
|
||||
entity3.set(Coroutine(__create_spike(world)))
|
||||
case "__horizontal_projectile":
|
||||
entity3.set(Coroutine(__horizontal_projectile(world)))
|
||||
case _:
|
||||
pass
|
||||
elif i == 3:
|
||||
match fonction:
|
||||
case "__rainning_projectiles":
|
||||
entity4.set(Coroutine(__rainning_projectiles(world)))
|
||||
case "__create_zone_attack":
|
||||
for i in range(5):
|
||||
entity4.set(Coroutine(__create_zone_attack(world)))
|
||||
yield wait(5)
|
||||
case "__create_spike":
|
||||
entity4.set(Coroutine(__create_spike(world)))
|
||||
yield wait(25)
|
||||
entity4.set(Coroutine(__create_spike(world)))
|
||||
case "__horizontal_projectile":
|
||||
entity4.set(Coroutine(__horizontal_projectile(world)))
|
||||
world.new_entity().set(
|
||||
AWave(), Coroutine(__horizontal_projectile(world))
|
||||
)
|
||||
case _:
|
||||
pass
|
||||
|
||||
yield wait(float(world[Wave].wave_list[-1][0]))
|
||||
entity.destroy()
|
||||
entity2.destroy()
|
||||
entity3.destroy()
|
||||
entity4.destroy()
|
||||
entity5.destroy()
|
||||
for entity_to_destroy in world.query(AWave):
|
||||
entity_to_destroy.destroy()
|
||||
for entities in world.query(
|
||||
RainProjectiles or ZoneAttack or Spike or HorizontalProjectiles
|
||||
):
|
||||
|
@ -410,6 +363,8 @@ def __wave(world: World):
|
|||
|
||||
|
||||
def __create_zone_attack(world: World):
|
||||
for _ in range(5):
|
||||
yield wait(5)
|
||||
"""
|
||||
TODO
|
||||
"""
|
||||
|
@ -447,7 +402,8 @@ def __create_zone_attack(world: World):
|
|||
TimedEvent(0.4, lambda world, entity: entity.destroy()),
|
||||
)
|
||||
projectiles[smooth.Target] = Vec2(
|
||||
i * 41 + world[FightBox].p1[0] + (locate * 413), world[FightBox].p2[1]
|
||||
i * 41 + world[FightBox].p1[0] + (locate * 413),
|
||||
world[FightBox].p2[1],
|
||||
)
|
||||
|
||||
else:
|
||||
|
@ -494,15 +450,14 @@ def __create_zone_attack(world: World):
|
|||
world[FightBox].p2[1],
|
||||
)
|
||||
locate = locate2
|
||||
for entities in world.query(ZoneAttackProjectiles):
|
||||
entities.destroy()
|
||||
|
||||
|
||||
def __create_spike(world: World):
|
||||
"""
|
||||
TODO
|
||||
"""
|
||||
|
||||
for _ in range(2):
|
||||
yield wait(15.0)
|
||||
temp_warning_spike = world.new_entity()
|
||||
temp_warning_spike.set(
|
||||
Sprite(
|
||||
|
@ -653,6 +608,7 @@ def __horizontal_projectile(world: World):
|
|||
)
|
||||
entity = world.new_entity()
|
||||
entity.set(
|
||||
HorizontalProjectiles(),
|
||||
Sprite(
|
||||
world[Assets].get_texture("error"),
|
||||
Vec2(10, random.randint(500, 930)),
|
||||
|
@ -661,13 +617,12 @@ def __horizontal_projectile(world: World):
|
|||
animation,
|
||||
smooth.Speed(2),
|
||||
Hurt(10),
|
||||
HorizontalProjectiles(),
|
||||
)
|
||||
yield animation.wait()
|
||||
yield wait(1)
|
||||
entity.set(smooth.Target(Vec2(1500, entity[Sprite].position.y)))
|
||||
|
||||
for entity in world.query(RainProjectiles, Sprite):
|
||||
for entity in world.query(HorizontalProjectiles, Sprite):
|
||||
if entity[Sprite].position.x > 1440:
|
||||
entity.destroy()
|
||||
|
||||
|
|
Loading…
Reference in a new issue