diff --git a/src/scenes/game.py b/src/scenes/game.py index a7302fa..b30d352 100644 --- a/src/scenes/game.py +++ b/src/scenes/game.py @@ -180,8 +180,9 @@ class Bonus(Enum): REVERSE = 3 @staticmethod - def aleatoire(): - type = random.randint(0, 3) + def aleatoire(world: World): + max = 3 if world[GameMode] == GameMode.ONE else 2 + type = random.randint(0, max) match type: case 0: return Bonus.MULTI @@ -324,7 +325,7 @@ def __spawn_ellements(world: World): def __spawn_bonus(world: World): - bonus = Bonus.aleatoire() + bonus = Bonus.aleatoire(world) world.new_entity().set( SpriteBundle( Bonus.get_texture(bonus), @@ -369,7 +370,7 @@ def __spawn_ball(world: World): def __collision_with_ball(a: Entity, b: Entity): if Ball in a: a.world.new_entity().set(Sound("bound.mp3")) - if Player1 in b or Player2 in b: + if Player1 in b or Player2 in b and Ball in a: for player in a.world.query(LastPlayerTurn): del player[LastPlayerTurn] b.set(LastPlayerTurn())