Reglage des problemes avec les bonnus (#25)

Reviewed-on: #25
Reviewed-by: Tipragot <contact@tipragot.fr>
Co-authored-by: CoCoSol007 <solois.corentin@gmail.com>
Co-committed-by: CoCoSol007 <solois.corentin@gmail.com>
This commit is contained in:
CoCo_Sol 2024-01-07 10:43:02 +00:00 committed by Tipragot
parent d668dc9c4b
commit 9d80531c2f

View file

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