This commit is contained in:
Raphaël 2023-11-04 00:44:27 +01:00
parent a5adc13848
commit 6eb223c9b2

View file

@ -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):