Example #1
0
def gestionCollisionBonusBarres():
    global gestionCollisonBonusBarre

    for i in range(barres.nbBarre()):
        k = 0
        for j in range(bonus.nbBonus()):
            enleverBonus = gestionCollisonBonusBarre(k, i)
            if not enleverBonus:
                k += 1

    k = 0
    for i in range(bonus.nbBonus()):
        if bonus.y[k] > config.HEIGHT:
            bonus.enleverBonus(k)
        else:
            k += 1
Example #2
0
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()