From 845c7cd6d81de89fb25094b692673626a2c2bc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl?= Date: Mon, 8 Jan 2024 20:36:43 +0000 Subject: [PATCH] Correction de la velocity d'apparition de la balle du bonus multi (#46) Co-authored-by: raphael Reviewed-on: https://git.tipragot.fr/raphael/ponguito/pulls/46 --- src/scenes/game.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/scenes/game.py b/src/scenes/game.py index fb8950b..88f329b 100644 --- a/src/scenes/game.py +++ b/src/scenes/game.py @@ -208,6 +208,13 @@ class Bonus(Enum): case _: return "reverse.png" +class OriginBall(Entity): + """ + Composant qui represente la balle ratttaché a la balle simulée. + """ + + def __init__(self, entity: Entity): + super().__init__(entity.world, entity.identifier) def __spawn_elements(world: World): """ @@ -414,6 +421,7 @@ def __check_bonus_collision(world: World): Velocity(entity[Velocity]), Origin(entity[Origin]), CollisionHandler(__collision_handler), + OriginBall(entity), ) physics.move_entity(simulated_ball, entity[Velocity] * world[Delta]) simulated_ball.destroy() @@ -430,8 +438,8 @@ def __bonus_touched(ball: Entity, bonus: Entity): match bonus[Bonus]: case Bonus.MULTI: # Fait apparaitre une balle qui part dans le sens inverse de la balle principale - velo = Vec2(ball[Velocity]) - velo.y *= -1 + velo = Vec2(ball[OriginBall][Velocity]) + velo *= -1 bonus.world.new_entity().set( SpriteBundle( "ball.png",