Reglage des problemes avec les bonnus #25
|
@ -180,8 +180,9 @@ class Bonus(Enum):
|
||||||
REVERSE = 3
|
REVERSE = 3
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def aleatoire():
|
def aleatoire(world: World):
|
||||||
type = random.randint(0, 3)
|
max = 3 if world[GameMode] == GameMode.ONE else 2
|
||||||
|
type = random.randint(0, max)
|
||||||
match type:
|
match type:
|
||||||
case 0:
|
case 0:
|
||||||
return Bonus.MULTI
|
return Bonus.MULTI
|
||||||
|
@ -324,7 +325,7 @@ def __spawn_ellements(world: World):
|
||||||
|
|
||||||
|
|
||||||
def __spawn_bonus(world: World):
|
def __spawn_bonus(world: World):
|
||||||
bonus = Bonus.aleatoire()
|
bonus = Bonus.aleatoire(world)
|
||||||
world.new_entity().set(
|
world.new_entity().set(
|
||||||
SpriteBundle(
|
SpriteBundle(
|
||||||
Bonus.get_texture(bonus),
|
Bonus.get_texture(bonus),
|
||||||
|
@ -369,7 +370,7 @@ def __spawn_ball(world: World):
|
||||||
def __collision_with_ball(a: Entity, b: Entity):
|
def __collision_with_ball(a: Entity, b: Entity):
|
||||||
if Ball in a:
|
if Ball in a:
|
||||||
a.world.new_entity().set(Sound("bound.mp3"))
|
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):
|
for player in a.world.query(LastPlayerTurn):
|
||||||
del player[LastPlayerTurn]
|
del player[LastPlayerTurn]
|
||||||
b.set(LastPlayerTurn())
|
b.set(LastPlayerTurn())
|
||||||
|
|
Loading…
Reference in a new issue