diff --git a/src/scenes/game.py b/src/scenes/game.py index 56dddaa..a49529b 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",