From 6eb223c9b2d37899efeb2006afd0165115ba928a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl?= Date: Sat, 4 Nov 2023 00:44:27 +0100 Subject: [PATCH] Update --- src/scenes/story/boss_fight.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/scenes/story/boss_fight.py b/src/scenes/story/boss_fight.py index 6a2899d..7571770 100644 --- a/src/scenes/story/boss_fight.py +++ b/src/scenes/story/boss_fight.py @@ -45,6 +45,12 @@ class ZoneAttack: """ +class Life: + """ + Ressource qui correspond a la vie du joueur + """ + + def __initialize_world(world: World): world.set(ShieldPos(Vec2(render.WIDTH / 2, 750))) world.set(FightBox()) @@ -64,20 +70,21 @@ def __initialize_world(world: World): def __move(world: World): held = world[Held] + s_pos = world[ShieldPos] for entity in world.query(Sprite, Velocity): for keys in held: if keys == "up": - if world[ShieldPos].y - entity[Velocity] > world[FightBox].p1[1]: - world[ShieldPos].y -= entity[Velocity] + if s_pos.y - 45.5 - entity[Velocity] > world[FightBox].p1[1]: + s_pos.y -= entity[Velocity] if keys == "down": - if world[ShieldPos].y + entity[Velocity] < world[FightBox].p2[1]: - world[ShieldPos].y += entity[Velocity] + if s_pos.y + 45.5 + entity[Velocity] < world[FightBox].p2[1]: + s_pos.y += entity[Velocity] if keys == "left": - if world[ShieldPos].x - entity[Velocity] > world[FightBox].p1[0]: - world[ShieldPos].x -= entity[Velocity] + if s_pos.x - 37 - entity[Velocity] > world[FightBox].p1[0]: + s_pos.x -= entity[Velocity] if keys == "right": - if world[ShieldPos].x + entity[Velocity] < world[FightBox].p2[0]: - world[ShieldPos].x += entity[Velocity] + if s_pos.x + 37 + entity[Velocity] < world[FightBox].p2[0]: + s_pos.x += entity[Velocity] def __create_zone_attack(world: World):