Ajout de sons

This commit is contained in:
Tipragot 2023-11-05 21:20:02 +01:00
parent 5d9cbdc1b6
commit 7149019109
9 changed files with 14 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -216,7 +216,7 @@ def loading_scene(target: Scene, name: str, clear_cache: bool = True):
order=1000000001,
area=(0, 0, 0, render.HEIGHT),
),
Sound(assets.waiting_sound, loop=True, fade_ms=10000),
Sound(assets.waiting_sound, loop=True),
)
@staticmethod

View file

@ -19,6 +19,10 @@ from plugins.assets import Assets
from plugins.coroutine import condition, wait, Coroutine
from plugins.sound import Sound
from plugins.timing import Delta, TimedEvent
from plugins.multisound import MultiSound
SHOOT = MultiSound("shoot/1", "shoot/2", "shoot/3", volume=0.1)
class Velocity(int):
@ -144,6 +148,8 @@ def __initialize_world(world: World):
"""
TODO
"""
world.new_entity().set(Sound(world[Assets].get_sound("music"), True, 0.5))
world.set(
ShieldPos(Vec2(render.WIDTH / 2, 750)),
FightBox(),
@ -317,6 +323,7 @@ def __check_hurt(world: World):
)
else:
entity.destroy()
world.new_entity().set(Sound(world[Assets].get_sound("hit")))
world.new_entity().set(Coroutine(__set_hurtable_hurt(world)))
world.set(Hurtable.FALSE)
__update_life_bar(world)
@ -335,6 +342,8 @@ def __defeat(world: World):
entity.remove(smooth.Target)
for entity in world.query(Animation):
entity.remove(Animation)
for entity in world.query(Sound):
entity.remove(Sound)
for entity in world.query(Player):
entity.set(
@ -347,7 +356,7 @@ def __defeat(world: World):
world.new_entity().set(
Sprite(world[Assets].error_texture, order=20),
Animation("animation_bg_mort", 24),
Sound(world[Assets].get_sound("game_over"), True, 0.5, 10000),
Sound(world[Assets].get_sound("game_over"), True, 1),
)
elif len(world[Held]) > 0 and len(world.query(Animation)) == 0:
world[CurrentScene] = __new_game_scene()
@ -414,6 +423,7 @@ def __create_zone_attack(world: World, number: int = 2):
)
yield animation.wait()
entity.destroy()
world.new_entity().set(Sound(world[Assets].get_sound("zone")))
for i in range(10):
projectile = world.new_entity()
@ -624,6 +634,7 @@ def __rainning_projectiles(world: World, number: int = 20):
yield animation.wait()
yield wait(0.2)
entity.set(smooth.Target(Vec2(entity[Sprite].position.x, 1121)))
world.new_entity().set(SHOOT)
for entity in world.query(RainProjectiles, Sprite):
if entity[Sprite].position.y > 1080:
@ -650,6 +661,7 @@ def __horizontal_projectile(world: World, left: bool, number: int = 10):
)
yield animation.wait()
yield wait(1)
world.new_entity().set(SHOOT)
entity.set(
smooth.Target(Vec2(1500 if left else -81, entity[Sprite].position.y))
)