def update(): global root, changerNiveau, VIES if briques.hasBriqueBreakable() or animationsExplosion.nbExplosion() or animationsArtifice.NBANIMATIONS: if balles.nbBalle() or bonus.nbBonus(): collisions.gestionCollisions() balles.move() barres.move() bonus.move() animationsExplosion.explosionsMove() animationsArtifice.animationsArtificeMove() config.SPEED += config.SPEED_PER_FRAME root.after(1000 // (config.FPS), update) elif VIES: VIES -= 1 barres.enleverBarres() barres.ajouterBarre(config.WIDTH / 2 - 100, 500) balles.enleverBalles() config.SPEED = config.BALLE_SPEED_INIT balles.ajouterBalle(config.WIDTH / 2 - 10 + randrange(-5, 5), 350) root.after(1000 // (config.FPS), update) else: print("PERDU") root.quit() else: changerNiveau()
def changerNiveau(): global SEED, update briques.enleverBriques() SEED += "0" briques.initialiserBriques(SEED) barres.enleverBarres() barres.ajouterBarre(config.WIDTH / 2 - 100, 500) balles.enleverBalles() config.SPEED = config.BALLE_SPEED_INIT balles.ajouterBalle(config.WIDTH / 2 - 10 + randrange(-5, 5), 350) animationsArtifice.enleverAnimationsArtifice() animationsExplosion.enleverExplosions() bonus.enleverTousLesBonus() update()