Ajout fonction qui detecte la mort
This commit is contained in:
parent
5baa8bf2af
commit
d07f7bcc65
|
@ -5,7 +5,7 @@ Scene de Combat final contre edmond, inspiré du combat d'omega flowey dans unde
|
|||
from enum import Enum
|
||||
import random
|
||||
|
||||
from engine import Scene
|
||||
from engine import CurrentScene, Scene
|
||||
from engine.ecs import World
|
||||
from engine.math import Vec2
|
||||
from plugins import assets, smooth
|
||||
|
@ -89,7 +89,7 @@ def __initialize_world(world: World):
|
|||
origin=Vec2(0.5),
|
||||
),
|
||||
smooth.Target(world[ShieldPos]),
|
||||
Velocity(10),
|
||||
Velocity(6),
|
||||
)
|
||||
|
||||
|
||||
|
@ -144,6 +144,11 @@ def __check_hurt(world: World):
|
|||
world.new_entity().set(Coroutine(__set_hurtable_hurt(world)))
|
||||
|
||||
|
||||
def __defeat(world: World):
|
||||
if world[Life] <= 0:
|
||||
world[CurrentScene] = __new_game_scene()
|
||||
|
||||
|
||||
def __create_zone_attack(world: World):
|
||||
double = random.randint(1, 10)
|
||||
locate = random.randint(0, 2)
|
||||
|
@ -191,12 +196,21 @@ def __check_key_pressed(world: World):
|
|||
world.new_entity().set(Coroutine(__create_zone_attack(world)))
|
||||
|
||||
|
||||
SCENE = assets.loading_scene(
|
||||
def __new_game_scene() -> Scene:
|
||||
"""
|
||||
Créer une nouvelle scène
|
||||
"""
|
||||
return (
|
||||
Scene(
|
||||
[__initialize_world],
|
||||
[__move, __check_key_pressed, __check_hurt],
|
||||
[__move, __check_key_pressed, __check_hurt, __defeat],
|
||||
[],
|
||||
)
|
||||
+ smooth.PLUGIN,
|
||||
+ smooth.PLUGIN
|
||||
)
|
||||
|
||||
|
||||
SCENE = assets.loading_scene(
|
||||
__new_game_scene(),
|
||||
"story/boss_fight",
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue