def display_timer_X(case): pos_case = (level_pos[0] + 40 * (case[0] // 2) + 20, level_pos[1] + 40 * (case[1] // 2) + 20) utk.image(pos_case[0], pos_case[1], "sprites/X.gif", tag="X_" + str(case[0]) + "_" + str(case[1]))
def display_timer(x, y): """ Affiche le timer. Ne le met pas à jour. """ utk.efface("timer") if timer.timer_paused: utk.image(x + 50, y + 50, "sprites/hourglass_freeze.gif", tag="timer") else: utk.image(x + 50, y + 50, "sprites/hourglass.gif", tag="timer") if timer.timer > 0: utk.texte(x + 50, y + 110, str(int(timer.timer) // 60) + ":" + str(int(timer.timer % 60)), couleur="black", ancrage="center", police="Purisa", taille=28, tag="timer") else: utk.texte(x + 50, y + 110, "0:0", couleur="black", ancrage="center", police="Purisa", taille=28, tag="timer")
def display_cases(): for yy in range(1, len(lvl.level), 2): for xx in range(1, len(lvl.level[yy]), 2): y = yy // 2 # Calcul du numéro de la case x = xx // 2 case = lvl.level[yy][ xx] # Récupération de la valeur la case en question # Centre de la position de la case en question case_pos = (x * 40 + 20 + level_pos[0], y * 40 + 20 + level_pos[1]) # Affichage du sol if lvl.meanings[case] not in ("wall", "unexplored"): utk.image(case_pos[0], case_pos[1], "sprites/ground.gif") # Affichage des zones à voler if "to steal" in lvl.meanings[case] and not lvl.has_stolen: utk.image(case_pos[0], case_pos[1], "sprites/stuff_" + lvl.meanings[case].replace("to steal ", "") + ".gif", tag="to_steal") # Affichage des sorties elif "exit" in lvl.meanings[case]: utk.image( case_pos[0], case_pos[1], "sprites/exit_" + lvl.meanings[case].replace("exit ", "") + ".gif") if not lvl.has_stolen: utk.image(case_pos[0], case_pos[1], "sprites/X.gif", tag="closed")
def affichageTuiles(matriceTuiles): """Affiche les tuiles sur le plateau""" tuile = set([str(i) for i in range(1, 10)]) for ligne in range(len(matriceTuiles)): for colonne in range(len(matriceTuiles[0])): if matriceTuiles[ligne][colonne][0] in tuile: tuile.discard(matriceTuiles[ligne][colonne][0]) Nligne, Ncolonne = conversionCoordonnee((ligne, colonne), matriceTuiles) tk.image(Ncolonne+60, Nligne+60, "tuile"+matriceTuiles[ligne][colonne]+".gif")
def display_escalators(): for c_pos in lvl.escalator.keys(): pair = (c_pos, lvl.escalator[c_pos]) delta = ((pair[1][0] - pair[0][0]) // 2, (pair[1][1] - pair[0][1]) // 2) if delta[1]>=0 and (delta[0]>=0 \ or (delta[0]>=-2 and delta[1]>0)): utk.image( level_pos[0] + pair[0][0] // 2 * 40 + 20, level_pos[1] + pair[0][1] // 2 * 40 + 20, "sprites/escalator/" + str(delta[0]) + "_" + str(delta[1]) + ".gif")
def draw_entity(self, entity: Person): (top, right, bottom, left) = self.get_dimensions(entity.x, entity.y) if entity.get_type() == Person.ARIANE: upemtk.image(top, left, self.ARIANE_IMAGE_PATH, ancrage='nw') elif entity.get_type() == Person.THESEE: upemtk.image(top, left, self.THESEE_IMAGE_PATH, ancrage='nw') elif entity.get_type() == Person.PORTE: upemtk.image(top, left, self.DOOR_IMAGE_PATH, ancrage='nw') elif entity.get_type() == Person.VERTICAL_MINAUTORE: upemtk.image(top, left, self.MINO_V_IMAGE_PATH, ancrage='nw') elif entity.get_type() == Person.HORIZONTAL_MINAUTORE: upemtk.image(top, left, self.MINO_H_IMAGE_PATH, ancrage='nw')
def display_pion(p): """ Réaffiche le pion indiqué. :param int p: numéro du pion """ utk.efface("pion" + str(p)) name = lvl.pion_name[p] # Affichage de la magicienne en mode fantome if name == "magicienne" and lvl.ghost_mod: utk.image(lvl.pion_pos[p][0] // 2 * 40 + 20 + level_pos[0], lvl.pion_pos[p][1] // 2 * 40 + 20 + level_pos[1], "sprites/magicienne_ghost.gif", tag="pion" + str(p)) # Affichage des autres pions else: if "grenouille" in name: name = "grenouille" utk.image(lvl.pion_pos[p][0] // 2 * 40 + 20 + level_pos[0], lvl.pion_pos[p][1] // 2 * 40 + 20 + level_pos[1], "sprites/" + name + ".gif", tag="pion" + str(p)) # Affichage si le pion mange if name == lvl.eating: utk.image(lvl.pion_pos[p][0] // 2 * 40 + 20 + level_pos[0], lvl.pion_pos[p][1] // 2 * 40 + 20 + level_pos[1], "sprites/eating.gif", tag="pion" + str(p)) if name == "magicienne" and lvl.invisible: utk.image(lvl.pion_pos[p][0] // 2 * 40 + 20 + level_pos[0], lvl.pion_pos[p][1] // 2 * 40 + 20 + level_pos[1], "sprites/invisibility_circle.gif", tag="pion" + str(p))
def display_discuss(x, y): utk.image(win_size[0] / 2, win_size[1] / 2, "sprites/discuss.gif", tag="discuss_icon") utk.texte(x, y, "ENTREE pour \nreprendre...", ancrage="nw", taille=10, tag="discuss_info") display_frame()
def display_X_vortex(): """ Affiche la fermeture des vortex """ for y in range(1, len(lvl.level), 2): for x in range(1, len(lvl.level[y]), 2): case = lvl.level[y][ x] # Récupération de la valeur la case en question if "vortex" in lvl.meanings[case]: # Centre de la position de la case en question case_pos = (x // 2 * 40 + 20 + level_pos[0], y // 2 * 40 + 20 + level_pos[1]) utk.image(case_pos[0], case_pos[1], "sprites/X.gif")
def affichageMurs(mursHor, mursVer): """Affiche tous les murs à leur emplacement sur le plateau""" # Murs horizontaux for ligne in range(len(mursHor)): for colonne in range(len(mursHor[0])): if mursHor[ligne][colonne]: ligneP, colonneP = conversionCoordonneesMurHor((ligne, colonne)) tk.image(colonneP, ligneP, "murHor.gif") # Murs verticaux for ligne in range(len(mursVer)): for colonne in range(len(mursVer[0])): if mursVer[ligne][colonne]: ligneP, colonneP = conversionCoordonneesMurVer((ligne, colonne)) tk.image(colonneP, ligneP, "murVer.gif")
def display_between_cases(): for yy in range(0, len(lvl.level), 2): for xx in range(1, len(lvl.level[yy]), 2): y = yy // 2 # Calcul du numéro de la case x = xx // 2 case = lvl.level[yy][ xx] # Récupération de la valeur la case en question # Centre de la position de la case en question case_pos = (x * 40 + 20 + level_pos[0], y * 40 + level_pos[1]) # Affichage des murs if lvl.meanings[case] == "wall": utk.image(case_pos[0], case_pos[1], "sprites/wall_horizontal.gif")
def afficherPion(numeroPion, infoPion, matriceTuiles): """ Affiche au bon emplacement le joueur choisi Args: numeroPion (int): entre 1 et 4 infoPion (dict): dictionnaire d'info sur la position des pions animation (bool): False --> désactive les animations Returns: None. """ positionFinale = infoPion[numeroPion][0] positionFinale = conversionCoordonnee(positionFinale, matriceTuiles) listeImage = ['pionViolet.gif', 'pionJaune.gif', 'pionVert.gif', 'pionOrange.gif', 'garde.gif', 'garde.gif', 'garde.gif'] tk.image(positionFinale[1], positionFinale[0], listeImage[numeroPion-1])
def display_selected_ingame(x, y, select_value, list_choice, tag_name="default"): """ Affiche le pion sélectionné en jeu. """ utk.efface(tag_name) utk.image(x + 20, y + 10, "sprites/select_arrow_up.gif", tag=tag_name) utk.image(x + 20, y + len(list_choice) * 40 + 30, "sprites/select_arrow_down.gif", tag=tag_name) for i in range(len(list_choice)): utk.rectangle(x, y + i * 40 + 20, x + 40, y + (i + 1) * 40 + 20, couleur="black", remplissage="cyan" * (i == select_value), epaisseur=2, tag=tag_name) utk.image(x + 20, y + i * 40 + 40, "sprites/" + list_choice[i] + ".gif", tag=tag_name)
def display_control(): utk.image(win_size[0] // 2, win_size[1] // 2, "sprites/control.gif", tag="choice")
def affichageVortexActif(pionActif, vortexActif, dicVortex, matriceTuiles): ligne, colonne = conversionCoordonnee(dicVortex[pionActif][vortexActif[0]-1], matriceTuiles) tk.image(colonne, ligne, 'vortexSelect.gif')
def display_vortex(case_pos, meaning_case): """ Affiche le vortex liée à la case et sa couleur. """ sprite_name = "sprites/" + meaning_case.replace(" ", "_") + ".gif" utk.image(case_pos[0], case_pos[1], sprite_name)
utk.image(case_pos[0], case_pos[1], "sprites/wall_horizontal.gif") for yy in range(1, len(lvl.level), 2): for xx in range(0, len(lvl.level[yy]), 2): y = yy // 2 # Calcul du numéro de la case x = xx // 2 case = lvl.level[yy][ xx] # Récupération de la valeur la case en question # Centre de la position de la case en question case_pos = (x * 40 + level_pos[0], y * 40 + 20 + level_pos[1]) # Affichage des murs if lvl.meanings[case] == "wall": utk.image(case_pos[0], case_pos[1], "sprites/wall_vertical.gif") def display_cases(): for yy in range(1, len(lvl.level), 2): for xx in range(1, len(lvl.level[yy]), 2): y = yy // 2 # Calcul du numéro de la case x = xx // 2 case = lvl.level[yy][ xx] # Récupération de la valeur la case en question # Centre de la position de la case en question case_pos = (x * 40 + 20 + level_pos[0], y * 40 + 20 + level_pos[1]) # Affichage du sol if lvl.meanings[case] not in ("wall", "unexplored"):
def display_selected_target_confirmed(pos_case): utk.efface("target_select_confirmed") utk.image(pos_case[0] // 2 * 40 + 20 + level_pos[0], pos_case[1] // 2 * 40 + 20 + level_pos[1], "sprites/select_ingame_confirmed.gif", tag="target_select_confirmed")