def initialiserBriques(seed, difficulte=20): global ajouterBrique, enleverBriques enleverBriques() dicoBriques = procgen.procgen(seed, difficulte) for dico in dicoBriques: ajouterBrique(dico['x'], dico['y'], dico['pv'], dico['bonus'], dico['bonus_contenu'])
def changerNiveau(self): '''Fonction gérant le passage à un nouveau niveau''' tmp = 0 for balle in self.balles: balle.x = self.barres[tmp%(1+int(self.mode=="coop"))].x+\ self.barres[tmp%(1+int(self.mode=="coop"))].w//2-10 + randrange(-5, 5) balle.y = self.barres[tmp%(1+int(self.mode=="coop"))].y-200 balle.dx = randrange(-5, 5)/10 balle.dy = randrange(2, 4) config.CANVAS.coords(balle.surface, balle.x, balle.y, balle.x+balle.w, balle.y+balle.h) tmp += 1 del tmp if (config.SCORE == 0): self.balles.append(Balle(self.barres[0].x+self.barres[0].w//2-10 + randrange(-5, 5), 350)) if (self.mode == "coop"): self.balles.append(Balle(self.barres[1].x+self.barres[1].w/2-10 + randrange(-5, 5), 400)) # Suppression bonus for b in self.bonus: self.bonus.remove(b) self.bonus = [] # Suppression animations for animation in self.animations: animation.die() self.animations = list() # Suppression puis création briques if (self.mode == 'arcade' or self.mode == 'coop' or self.mode == 'auto'): if config.SCORE != 0: # si ce n'est pas le premier niveau self.seed = str(int(self.seed, 36) + 1) self.difficulty = max(self.difficulty, self.difficulty+10) self.briques = procgen.procgen(self.seed, self.difficulty) elif (self.mode == 'campagne'): if (self.seed < 9): self.briques = readFile(str(self.seed)) for brique in self.briques: brique.draw() self.seed += 1 else: print("Campagne terminée !!! TODO : A gérer score et fin") # affichage Bandeau config.CANVAS.tag_raise("bandeau")