Correction de la velocity d'apparition de la balle du bonus multi #46
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue