Exemplo n.º 1
0
 def interface(self):
     fond = pygame.image.load("menu/inventory/fond.jpg").convert()
     while 1:
         for event in pygame.event.get():
             if event.type == QUIT:
                 closemenu()
             if event.type == KEYDOWN and event.key == K_ESCAPE:
                 return
             if event.type == MOUSEMOTION:
                 testrect.x = event.pos[0]
                 testrect.y = event.pos[1]
             if event.type == MOUSEBUTTONUP:
                 if event.button == 1:
                     if self.bouton1().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         from Launcher import launcher
                         launcher()
                     if self.bouton2().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         closemenu()
                     if self.bouton3().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         toreturn = aide().interface()
                         if toreturn == "return":
                             return
         fenetre.blit(fond, (0, 0))
         fenetre.blit(self.image, self.rect)
         fenetre.blit(self.bouton1().image, self.rect)
         fenetre.blit(self.bouton2().image, self.rect)  #Affichage
         fenetre.blit(self.bouton3().image, self.rect)
         pygame.display.flip()
Exemplo n.º 2
0
 def interface(self):
     fond = pygame.image.load("menu/inventory/fond.jpg").convert()
     while 1:
         for event in pygame.event.get():
             if event.type == QUIT:
                 closemenu()
             if event.type == KEYDOWN and event.key == K_ESCAPE:
                 return
             if event.type == MOUSEMOTION:
                 testrect.x = event.pos[0]
                 testrect.y = event.pos[1]
             if event.type == MOUSEBUTTONUP:
                 if event.button == 1:
                     if self.bouton1().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         self.tutoriel()
                     if self.bouton2().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         quetefi = open("menu/quetes/active", "r")
                         pnj = quetefi.read()
                         quetefi.close()
                         dialogue.affichquete(pnj)
                     if self.bouton3().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         self.unstuck()
                         return "return"
         fenetre.blit(fond, (0, 0))
         fenetre.blit(self.image, self.rect)
         fenetre.blit(self.bouton1().image, self.rect)
         fenetre.blit(self.bouton2().image, self.rect)  # Affichage
         fenetre.blit(self.bouton3().image, self.rect)
         pygame.display.flip()
Exemplo n.º 3
0
 def interface(self):
     fond = pygame.image.load("menu/inventory/screenshot.jpg").convert()
     while 1:
         for event in pygame.event.get():
             if event.type == QUIT:
                 closemenu(fenetre)
             if event.type == KEYDOWN and event.key == K_ESCAPE:
                 return
             if event.type == MOUSEMOTION:
                 testrect.x = event.pos[0]
                 testrect.y = event.pos[1]
             if event.type == MOUSEBUTTONUP:
                 if event.button == 1:
                     if self.bouton1().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         self.voyage("cheminfjord")
                     if self.bouton2().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         self.voyage("capitale")
                     if self.bouton3().mask.overlap(
                             testmask, (testrect.x - self.rect.x,
                                        testrect.y - self.rect.y)):
                         self.voyage("village")
         fenetre.blit(fond, (0, 0))
         fenetre.blit(self.image, self.rect)
         fenetre.blit(self.bouton1().image, self.rect)
         fenetre.blit(self.bouton2().image, self.rect)  #Affichage
         fenetre.blit(self.bouton3().image, self.rect)
         pygame.display.flip()
Exemplo n.º 4
0
    def interface(self):
        fond=pygame.image.load("Endless/fond.jpg").convert()
        while 1:
            for event in pygame.event.get():
                if event.type == QUIT:
                    closemenu()
                if event.type == KEYDOWN and event.key == K_ESCAPE:
                    return
                if event.type == MOUSEMOTION:
                    testrect.x = event.pos[0]
                    testrect.y = event.pos[1]
                if event.type == MOUSEBUTTONUP:
                    if event.button == 1:
                        if self.bouton1().mask.overlap(testmask, (testrect.x - self.rect.x, testrect.y - self.rect.y)):
                            shooter.endless(fenetre)
                        if self.bouton2().mask.overlap(testmask, (testrect.x - self.rect.x, testrect.y - self.rect.y)) and self.RPGlock:
                            maps.selecmap()
                        if self.bouton3().mask.overlap(testmask, (testrect.x - self.rect.x, testrect.y - self.rect.y)):
                            g = Jeu()
                            g.start_screen()
                            while g.running:
                                g.new()
                                g.game_over_screen()

                            pygame.quit()
                            sys.exit()
            fenetre.blit(fond, (0,0))
            fenetre.blit(self.image, self.rect)
            fenetre.blit(self.bouton1().image, self.rect)
            fenetre.blit(self.bouton2().image, self.rect)#Affichage
            fenetre.blit(self.bouton3().image, self.rect)
            pygame.display.flip()
Exemplo n.º 5
0
def jeanmadia(message, mode="retour",pnj = "jeanma"):
    """Fonction qui permet l'affichage des dialogues pnj perso"""
    activefich = open("menu/quetes/pnjrencontre", "w")
    activefich.write(pnj)  # On sauvegarde le pnj rencontrés pour les quêtes
    activefich.close()
    pygame.image.save(fenetre, "menu/inventory/screenshot.jpg")  # mini-jeux (phase de test)
    fond = pygame.image.load("menu/inventory/screenshot.jpg").convert()
    clock = pygame.time.Clock()
    dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
    imagepnj = pygame.image.load("menu/pnj/"+pnj+"/"+pnj+"_tall.png").convert_alpha()  # image du pnj à droite
    if mode == "retour":
        bouton2 = pygame.image.load("menu/quetes/HUD/boutonretour.png").convert_alpha()
    elif mode == "valider":
        bouton2 = pygame.image.load("menu/quetes/HUD/boutonvalider.png").convert_alpha()
    elif mode == "suivant":
        bouton2 = pygame.image.load("menu/quetes/HUD/boutonsuivant.png").convert_alpha()
    bouton2rect = bouton2.get_rect()
    bouton2rect.x = 420
    bouton2rect.y = 545
    taillepnj = imagepnj.get_size()
    x = 0
    tobreak = False
    i = 0
    while 1:

        for event in pygame.event.get():
            if event.type == QUIT:
                closemenu.closemenu()
                fenetre.blit(fond, (0, 0))
            if event.type == MOUSEMOTION:
                if event.type == MOUSEMOTION:
                    testrect.x = event.pos[0]
                    testrect.y = event.pos[1]
            if event.type == MOUSEBUTTONDOWN:
                if event.button == 1:
                    if testrect.colliderect(bouton2rect):
                        return

        fenetre.blit(dialoguequete, (0, 374))
        dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
        fenetre.blit(imagepnj, (10, 540 - taillepnj[1]))
        fenetre.blit(bouton2, bouton2rect)
        dialoguequete.blit(police.render(message, True, (32, 153, 152)), (175, 10 + 15 * i))

        clock.tick(60)  # 60 FPS
        pygame.display.flip()
Exemplo n.º 6
0
def tourpartour():  # fonction principale avec variables
    fichier = open("menu/quetes/mobmort", "r")
    nomennemie = fichier.read()
    fichier.close()
    if nomennemie == "":
        return

    chargementsauvegarde()
    action = ["attaque", "objet", "fuite", ""]
    perso_joueur.ingame = True

    armure = "cuir"

    choix = 1  # le choix de l'action
    c = False  # la validation du choix
    d = 0

    a = 0  # une variable de validation de fin de combat.tour

    combat.tour = 1  # combat.tour=1=combat.tourperso   combat.tour=0=combat.tourennemi combat.tourperso2=combat.tour=2 etc

    pygame.key.set_repeat(200, 200)
    clock = pygame.time.Clock()
    if armure == "cuir":
        perso_joueur.armure = 2
    if armure == "chevalier":
        perso_joueur.armure = 8
    if armure == "r":
        perso_joueur.armure = 0
    if armure == "magique":
        perso_joueur.armure = 7
        perso_joueur.bonusmagique = 10

    base.menu_ = 1
    with open("save1/activation/perso3", "r") as sinatra.active:
        sinatra.active = bool(int(sinatra.active.read()))
    with open("save1/activation/sortdefeu") as perso_joueur.sortdefeu:
        perso_joueur.sortdefeu = bool(int(perso_joueur.sortdefeu.read()))
    combat.etat = "combatencour"

    while combat.etat == "combatencour":  # la boucle principal
        for event in pygame.event.get():
            if event.type == QUIT:  # pour pouvoir quitter le jeux
                closemenu.closemenu()
            if event.type == KEYDOWN:  # les deplacements
                if event.key == K_DOWN:
                    choix += 1
                    if choix == 5:
                        choix = 1
                    if choix == 4 and (base.menu_ == 1 or objet.menu_ == 1
                                       and not perso_joueur.ingame):
                        choix = 1
                if event.key == K_UP:
                    choix -= 1
                    if choix == 0:
                        if attaque.menu_ == 0:
                            choix = 3
                        else:
                            choix = 4
                if event.key == K_SPACE:
                    c = True

        if combat.tour == 1:
            perso_joueur.ingame = True
            david.ingame = False
            sinatra.ingame = False
            if c:
                if choix == 4 and attaque.menu_ == 1 and c:
                    attaque.menu_ = 0
                    base.menu_ = 1
                    choix = 1
                    c = False
                if choix == 1 and attaque.menu_ == 1 and c:
                    d = randint(1, 5) + 10 + (perso_joueur.ptforce * 2)
                    a = 1
                    c = False
                    attaque.menu_ = 0
                    base.menu_ = 1
                if choix == 3 and attaque.menu_ == 1 and c:
                    if perso_joueur.sortdefeu == True and perso_joueur.mana > 14:
                        d = 15 + +(perso_joueur.ptmana * 2)
                        perso_joueur.mana -= 15
                        a = 1
                        c = False
                        choix = 1
                        attaque.menu_ = 0
                        base.menu_ = 1
                        combat.anim = 1
                    elif perso_joueur.sortdefeu == True and perso_joueur.mana < 15:
                        c = False
                        choix = 1
                        attaque.menu_ = 0
                        base.menu_ = 1
                        a = 1
                        combat.anim = 2
                        perso_joueur.mana = 0
                    else:
                        c = False
                        choix = 1
                        attaque.menu_ = 0
                        base.menu_ = 1
                        a = 1
                        combat.anim = 2
                        perso_joueur.mana -= 15

                if choix == 2 and attaque.menu_ == 1 and c and perso_joueur.fleche > 0:
                    d = 13 + (perso_joueur.ptforce * 2)
                    perso_joueur.fleche -= 1
                    a = 1
                    c = False
                    choix = 1
                    attaque.menu_ = 0
                    base.menu_ = 1
                    combat.anim = 3

                if choix == 2 and attaque.menu_ == 1 and c and perso_joueur.fleche == 0:
                    c = False
                    choix = 1
                    attaque.menu_ = 0
                    base.menu_ = 1
                if objet.menu_ == 1:
                    choix, a, c = menuobjet(choix, a, c)
                elif base.menu_ == 1:
                    choix, c = menubase(choix, c)
            attaqued(d, nomennemie)

            if a == 1:
                affichage.affichageanim(d)
                combat.anim = 0
                d = 0
                if not david.alive:
                    if sinatra.alive and sinatra.active:
                        combat.tour = 3
                    else:
                        combat.tour = 0
                else:
                    combat.tour = 2
                c = False
                a = 0
                if perso_joueur.empoisoner > 0:
                    perso_joueur.empoisoner -= 1
                    perso_joueur.vie -= 10

            if attaque.menu_ == 1:
                if perso_joueur.sortdefeu:
                    action = ["l'epee", "arc", "sort de feu", "retour"]
                else:
                    action = [
                        "l'epee", "arc", "Vous ne savez pas lancer de sort",
                        "retour"
                    ]

            elif base.menu_ == 1:
                action = ["attaque", "objet", "fuite", ""]
            elif objet.menu_ == 1:
                action = [
                    "resurection", "potion de soin", "pôtion de mana", "retour"
                ]
            combat.anim = 0

        elif combat.tour == 2:
            perso_joueur.ingame = False
            david.ingame = True
            sinatra.ingame = False
            david.immortal = False
            if c and david.taunt == 0:
                if choix == 4 and attaque.menu_ == 1 and c:
                    attaque.menu_ = 0
                    base.menu_ = 1
                    choix = 1
                    c = False
                if choix == 3 and attaque.menu_ == 1 and c:
                    a = 1
                    c = False
                    attaque.menu_ = 0
                    base.menu_ = 1
                    david.immortal = True
                    combat.anim = 5
                if choix == 1 and attaque.menu_ == 1 and c:
                    d = randint(10, 20) + (david.ptforce * 2)
                    a = 1
                    c = False
                    attaque.menu_ = 0
                    base.menu_ = 1
                if choix == 2 and attaque.menu_ == 1 and c:
                    david.taunt = 3
                    a = 1
                    c = False
                    choix = 1
                    attaque.menu_ = 0
                    base.menu_ = 1
                    combat.anim = 4
                if objet.menu_ == 1:
                    choix, a, c = menuobjet(choix, a, c)
                elif base.menu_ == 1:
                    choix, c = menubase(choix, c)
            d = attaqued(d, nomennemie)
            if a == 1 or david.taunt > 0:
                if a == 1:
                    affichage.affichageanim(d)
                    d = 0
                if sinatra.alive and sinatra.active:
                    combat.tour = 3
                else:
                    combat.tour = 0
                c = False
                a = 0
                if david.taunt > 0:
                    david.taunt -= 1
                if david.empoisoner > 0:
                    david.empoisoner -= 1
                    david.vie -= 10
            if attaque.menu_ == 1:
                action = ["tatane de faurins", "insulte", "defense", "retour"]
            elif base.menu_ == 1:
                action = ["attaque", "objet", "fuite", ""]
            elif objet.menu_ == 1:
                action = ["resurection", "potion de soin", "retour", ""]
            combat.anim = 0

        elif combat.tour == 3:
            perso_joueur.ingame = False
            david.ingame = False
            sinatra.ingame = True
            if c:
                if choix == 3 and attaque.menu_ == 1 and c:
                    attaque.menu_ = 0
                    base.menu_ = 1
                    choix = 1
                    c = False
                if choix == 1 and attaque.menu_ == 1 and c:
                    d = 20 + (sinatra.ptforce * 2)
                    a = 1
                    c = False
                    attaque.menu_ = 0
                    base.menu_ = 1
                if choix == 2 and attaque.menu_ == 1 and c:
                    sinatra.poison = True
                    a = 1
                    c = False
                    choix = 1
                    attaque.menu_ = 0
                    base.menu_ = 1
                if objet.menu_ == 1:
                    choix, a, c = menuobjet(choix, a, c)
                elif base.menu_ == 1:
                    choix, c = menubase(choix, c)
            d = attaqued(d, nomennemie)
            if a == 1:
                affichage.affichageanim(d)
                d = 0
                combat.tour = 0
                c = False
                a = 0
            if attaque.menu_ == 1:
                action = ["attaque furtive", "empoisonnement", "retour", ""]
            elif base.menu_ == 1:
                action = ["attaque", "objet", "fuite", ""]
            elif objet.menu_ == 1:
                action = ["resurection", "potion de soin", "retour", ""]
            combat.anim = 0

        elif combat.tour == 0:
            if nomennemie == "loup":
                if sinatra.poison:
                    loup.vie -= 10
                loup.attaque()
            elif nomennemie == "soldat":
                if sinatra.poison:
                    soldatpt.vie -= 10
                soldatpt.attaque()
            elif nomennemie == "malarich":
                if sinatra.poison:
                    malarich.vie -= 10
                malarich.attaque()
            elif nomennemie == "avalogne":
                if sinatra.poison:
                    avalogne.vie -= 10
                avalogne.attaque()
            elif nomennemie == "voleur":
                voleur.attaque()
            elif nomennemie == "hornet":
                if sinatra.poison:
                    hornet.vie -= 10
                hornet.attaque()
            elif nomennemie == "sinatramechante":
                sinatramechante.attaque()
            elif nomennemie == "goddess":
                if sinatra.poison:
                    goddess.vie -= 10
                goddess.attaque()
            if perso_joueur.alive:
                combat.tour = 1
            elif not perso_joueur.alive and david.alive:
                combat.tour = 2
            else:
                combat.tour = 3

            if goddess.malediction > 0:
                perso_joueur.vie -= 10
                david.vie -= 10
                sinatra.vie -= 10
                goddess.vie += 30
                goddess.malediction -= 1
                if perso_joueur.vie < 0:
                    perso_joueur.vie = 0
                if david.vie < 0:
                    david.vie = 0
                if sinatra.vie < 0:
                    sinatra.vie = 0
                fennemi.verification()

        if nomennemie == "loup":
            enemitipe.vie = loup.vie
            enemitipe.image = loup.image
        if nomennemie == "soldat":
            enemitipe.vie = soldatpt.vie
            enemitipe.image = soldatpt.image
        if nomennemie == "malarich":
            enemitipe.vie = malarich.vie
            enemitipe.image = malarich.image
        if nomennemie == "avalogne":
            enemitipe.vie = avalogne.vie
            enemitipe.image = avalogne.image
        if nomennemie == "voleur":
            enemitipe.vie = voleur.vie
            enemitipe.image = voleur.image
        if nomennemie == "hornet":
            enemitipe.vie = hornet.vie
            enemitipe.image = hornet.image
        if nomennemie == "sinatramechante":
            enemitipe.vie = sinatramechante.vie
            enemitipe.image = sinatramechante.image
        if nomennemie == "goddess":
            enemitipe.vie = goddess.vie
            enemitipe.image = goddess.image

        affichage.affichage(action, choix)

        clock.tick(60)
    return combat.etat
Exemplo n.º 7
0
def affichquete(pnj):
    """fonction qui affiche la liste des quêtes en cour"""


    clock = pygame.time.Clock()
    dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
    pygame.image.save(fenetre, "menu/inventory/screenshot.jpg")  # mini-jeux (phase de test)
    fond = pygame.image.load("menu/inventory/screenshot.jpg").convert()
    textefi = open("menu/quetes/" + pnj + "/objectif", "r")
    text = textefi.read()
    textefi.close()
    quetedispof = open("menu/quetes/quetedispo", "r")
    quetedispo = quetedispof.read().split(",")
    quetedispof.close()
    quetefi = open("menu/quetes/liste", "r")
    queteli = quetefi.read()
    quetefi.close()
    imagepnj = pygame.image.load("menu/pnj/" + pnj + "/" + pnj + "_tall.png").convert_alpha()
    bouton1 = pygame.image.load("menu/quetes/HUD/boutonaccepter.png").convert_alpha()
    bouton2 = pygame.image.load("menu/quetes/HUD/boutonrefuser.png").convert_alpha()
    bouton1rect = bouton1.get_rect()
    bouton2rect = bouton2.get_rect()
    bouton1rect.x = 100
    bouton1rect.y = 545
    bouton2rect.x = 420
    bouton2rect.y = 545

    taillepnj = imagepnj.get_size()
    x = 0
    tobreak = False

    while 1:

        for event in pygame.event.get():
            if event.type == QUIT:
                closemenu.closemenu()
                fenetre.blit(fond, (0, 0))

            if event.type == KEYDOWN:
                if event.key == K_ESCAPE:
                    return
                if event.key == K_UP:
                    return
                if event.key == K_RIGHT:
                    return
                if event.key == K_LEFT:
                    return
                if event.key == K_DOWN:
                    return
            if event.type == MOUSEMOTION:
                if event.type == MOUSEMOTION:
                    testrect.x = event.pos[0]
                    testrect.y = event.pos[1]
            if event.type == MOUSEBUTTONDOWN:
                if event.button == 1:
                    if testrect.colliderect(bouton2rect):
                        return
                    if testrect.colliderect(bouton1rect):
                        quetefi = open("menu/quetes/liste", "r")
                        queteli = quetefi.read().split(",")
                        quetefi.close()
                        if pnj not in queteli and pnj in quetedispo:
                            quetefi = open("menu/quetes/liste", "a")
                            quetefi.write("," + pnj)
                            quetefi.close()
                            return

                        if pnj not in queteactive and pnj in queteli:
                            quetefi = open("menu/quetes/active", "w")
                            quetefi.write(pnj)
                            quetefi.close()
                            return

        tobreak = False
        fenetre.blit(dialoguequete, (0, 374))
        dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
        fenetre.blit(imagepnj, (10, 540 - taillepnj[1]))

        if pnj in queteli and pnj not in queteactive:
            bouton1 = pygame.image.load("menu/quetes/HUD/boutonactiver.png").convert_alpha()
            bouton2 = pygame.image.load("menu/quetes/HUD/boutonretour.png").convert_alpha()
            fenetre.blit(bouton1, bouton1rect)
        if pnj in queteli and pnj in queteactive:
            bouton2 = pygame.image.load("menu/quetes/HUD/boutonretour.png").convert_alpha()
        if pnj in quetedispo and pnj not in queteli:
            bouton1 = pygame.image.load("menu/quetes/HUD/boutonaccepter.png").convert_alpha()
            bouton2 = pygame.image.load("menu/quetes/HUD/boutonrefuser.png").convert_alpha()
            fenetre.blit(bouton1, bouton1rect)
        fenetre.blit(bouton2, bouton2rect)

        if len(text) > 65:

            affich = []
            k = 0
            motablit = text.split(" ")
            for i in range(int(len(text) / 65) + 3):

                affich.append("")
                while len(affich[i]) < 65:
                    if k < len(motablit) - 1:
                        if len(affich[i] + motablit[k] + " ") < 65:
                            affich[i] += motablit[k] + " "
                        else:
                            break
                        k += 1
                    else:
                        break
            if motablit[-1] not in affich[-1]:
                for i in range(len(alphabet)):
                    for j in range(len(affich)):
                        if alphabet[i] not in affich[j]:
                            affich[j] += motablit[-1]
                            tobreak = True
                            break
                    if tobreak:
                        break

            if len(affich) <= 10:
                for i in range(len(affich)):
                    dialoguequete.blit(police.render(affich[i], True, (32, 153, 152)), (175, 10 + 15 * i))
            else:

                tkey = pygame.key.get_pressed()
                if tkey[K_UP] and x + 374 + 15 * len(affich) + 25 > 550:

                    x -= 7.5
                    dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
                elif tkey[K_DOWN] and 384 + x + 10 <= 384:
                    x += 7.5
                    dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
                for i in range(len(affich)):
                    if x + 384 + 15 * i < 530:
                        dialoguequete.blit(police.render(affich[i], True, (32, 153, 152)), (175, x + 10 + 15 * i))
        if len(text) < 65:
            dialoguequete.blit(police.render(text, True, (32, 153, 152)), (175, 15))

        clock.tick(60)  # 60 FPS
        pygame.display.flip()
Exemplo n.º 8
0
def dialogue(pnj):
    """Fonction qui permet l'affichage des dialogues pnj perso"""
    listefi = os.listdir("menu/pnj/" + pnj)
    activefich = open("menu/quetes/pnjrencontre", "w")
    activefich.write(pnj)  # On sauvegarde le pnj rencontrés pour les quêtes
    activefich.close()
    pygame.image.save(fenetre, "menu/inventory/screenshot.jpg")  # mini-jeux (phase de test)
    fond = pygame.image.load("menu/inventory/screenshot.jpg").convert()
    clock = pygame.time.Clock()
    dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
    textefi = open("menu/pnj/" + pnj + "/dialogue", "r")
    textli = textefi.read().split(";")  # On ouvre une liste dans un fichier contenant divers dialogues possibles
    textefi.close()
    if (pnj + "_tall.png") in listefi:
        pnjtall=True
    else: pnjtall = False
    if pnjtall:
        imagepnj = pygame.image.load("menu/pnj/" + pnj + "/" + pnj + "_tall.png").convert_alpha()  # image du pnj à droite
        taillepnj = imagepnj.get_size()
    bouton1v = True if pnj == "palfrenier" else False
    quetedispof = open("menu/quetes/quetedispo", "r")
    quetedispo = quetedispof.read().split(",")  # On ouvre le fichier de sauvegarde contenant les quêtes disponibles
    quetedispof.close()

    if bouton1v:
        bouton1 = pygame.image.load("menu/quetes/HUD/boutonvoyager.png").convert_alpha()

    else : bouton1 = pygame.image.load("menu/quetes/HUD/boutonretour.png").convert_alpha()
    if pnj in quetedispo: # Si le pnj propose une quête on affiche le bouton quête
        bouton2 = pygame.image.load("menu/quetes/HUD/boutonquest.png").convert_alpha()
    else: bouton2 = pygame.image.load("menu/quetes/HUD/boutonretour.png").convert_alpha()#sinon simple retour
    bouton1rect = bouton1.get_rect()
    bouton1rect.x = 100
    bouton1rect.y = 545
    bouton2rect = bouton2.get_rect()

    bouton2rect.x = 420
    bouton2rect.y = 545

    quetefi = open("menu/quetes/active", "r")
    queteactive = quetefi.read()  # Quete active
    if queteactive == "jeanma":
        queteactive="histoire"
    quetefi.close()
    quete.quetes()

    x = 0
    tobreak = False
    text = textli[randint(0, len(textli) - 1)]
    i = 0
    nbrorfi = open("save1/invent/cpic", "r")
    nbror = int(nbrorfi.read())
    nbrorfi.close()
    while 1:
        for event in pygame.event.get():
            if event.type == QUIT:
                closemenu.closemenu()
                fenetre.blit(fond, (0, 0))
            if event.type == KEYDOWN:
                if event.key == K_ESCAPE:
                    return
                if event.key == K_UP:
                    return
                if event.key == K_RIGHT:
                    return
                if event.key == K_LEFT:
                    return
                if event.key == K_DOWN:
                    return
            if event.type == MOUSEMOTION:
                if event.type == MOUSEMOTION:
                    testrect.x = event.pos[0]
                    testrect.y = event.pos[1]
            if event.type == MOUSEBUTTONDOWN:
                if event.button == 1:
                    if bouton1v and testrect.colliderect(bouton1rect):
                            voyage = travel.travel()
                            voyage.interface()
                            fenetre.blit(fond, (0,0))
                    elif testrect.colliderect(bouton1rect):
                        return
                    if testrect.colliderect(bouton2rect) and pnj in quetedispo:
                        if pnj == "jeanma":
                            pnj =="histoire"
                        affichquete(pnj)  # boite de dialogue quete
                    elif testrect.colliderect(bouton2rect):
                        return

        tobreak = False  # Pour casser une boucle
        fenetre.blit(dialoguequete, (0, 374))
        dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
        fenetre.blit(imagepnj, (10, 540 - taillepnj[1])) if pnjtall else None
        if bouton1v or pnj in quetedispo:
            fenetre.blit(bouton2, bouton2rect)
            fenetre.blit(bouton1, bouton1rect)
        if pnj not in quetedispo:
            fenetre.blit(bouton2, bouton2rect)

        if len(text) > 65:  # Si le texte sort du cadre
            affich = []  # liste des lignes à afficher
            k = 0  # increment
            motablit = text.split(" ")  # On crée un liste avec tout les mots
            for i in range(int(len(text) / 65) + 3):

                affich.append("")
                while len(affich[i]) < 65:  # On rajoute des mots
                    if k < len(motablit) - 1:  # sauf si le nombre de caractère sort du cadre
                        if len(affich[i] + motablit[k] + " ") < 65:
                            affich[i] += motablit[k] + " "
                        else:
                            break
                        k += 1
                    else:
                        break
            if motablit[-1] not in affich[-1]:  # Si le dernier mot est décalé on le reblit dans la dernière phrase
                for i in range(len(alphabet)):
                    for j in range(len(affich)):
                        if alphabet[i] not in affich[j]:
                            affich[j] += motablit[-1]
                            tobreak = True
                            break
                    if tobreak:
                        break
            if len(affich) <= 10:  # Si on sort pas du cadre horizontale
                for i in range(len(affich)):  # blit normal
                    dialoguequete.blit(police.render(affich[i], True, (32, 153, 152)), (175, 10 + 15 * i))
            else:  # sinon on crée un curseur

                tkey = pygame.key.get_pressed()
                if tkey[K_UP] and x + 374 + 15 * len(affich) + 25 > 550:

                    x -= 7.5
                    dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
                elif tkey[K_DOWN] and 384 + x + 10 <= 384:
                    x += 7.5
                    dialoguequete = pygame.image.load("menu/quetes/HUD/boitedialogue.png").convert_alpha()
                for i in range(len(affich)):
                    if x + 384 + 15 * i < 530:
                        dialoguequete.blit(police.render(affich[i], True, (32, 153, 152)), (175, x + 10 + 15 * i))

        if len(text) < 65:
            dialoguequete.blit(police.render(text, True, (32, 153, 152)), (175, 10 + 15 * i))

        clock.tick(60)  # 60 FPS
        pygame.display.flip()
Exemplo n.º 9
0
def shop():
    fond = pygame.image.load("menu/inventory/fond.jpg").convert()
    follow = False
    curseurrect.x = 769
    curseurrect.y = 145
    inventairefi = open("map/shop_potion/liste", "r")
    objetinventaireimage = []
    achatstr = inventairefi.read().split(",")
    prixfi = open("map/shop_potion/prix", "r")
    prix = []
    prixstr = prixfi.read().split(",")

    bandeauhaut = pygame.image.load(
        "menu/inventory/bandeaumoney+quete.png").convert_alpha()
    inventairefi.close()
    prixfi.close()
    achat = []
    for i in range(len(achatstr)):
        achat.append([achatstr[i]])
        for j in range(len(achat)):
            fi = open("save1/objet/" + achat[i][0], "r")
            achat[i].append(int(fi.read()))
            fi.close()
    for i in range(len(achat)):
        objetinventaireimage.append(
            pygame.image.load(
                "menu/inventory/objetinventaire.png").convert_alpha())
        objetinventairerect.append(Rect(287, 160 + 99 * i, 461, 98))
    for i in range(len(prixstr)):
        prix.append([prixstr[i]])

    for i in range(len(achat)):
        achat[i][0] = pygame.image.load("menu/inventory/objets/" +
                                        achat[i][0] + ".png").convert_alpha()
    quetefi = open("menu/quetes/active", "r")
    queteactive = quetefi.read()
    queteactive = queteactive.capitalize()
    inventairemask = []
    inventairerect = []
    for i in range(len(achat)):
        inventairemask.append(pygame.mask.from_surface(achat[i][0]))
    quetefi.close()
    if queteactive != "":
        missionfi = open("menu/quetes/" + queteactive + "/toprint")
        mission = missionfi.read()
        missionfi.close()
    orfi = open("save1/invent/cpic", "r")
    tune = orfi.read()

    orfi.close()
    lior = list(tune)
    tune = int(tune)
    while 1:

        for event in pygame.event.get():
            if event.type == QUIT:
                closemenu.closemenu()
            if event.type == KEYDOWN:
                if event.key == K_e or event.key == K_ESCAPE:
                    return
                if event.key == K_DOWN and curseurrect.y < 558:
                    curseurrect.y += 99 / 1.5
                    for i in range(len(objetinventairerect)):
                        objetinventairerect[i][1] -= 98

                if event.key == K_UP and objetinventairerect[0][1] < 160:
                    curseurrect.y -= 98 / 1.5
                    for i in range(len(objetinventairerect)):
                        objetinventairerect[i][1] += 98
            if event.type == MOUSEMOTION:
                testrect.x = event.pos[0]
                testrect.y = event.pos[1]
            if event.type == MOUSEBUTTONDOWN:
                if testmask.overlap(
                        curseurmask,
                    (curseurrect.x - testrect.x, curseurrect.y - testrect.y)):
                    follow = True
                if event.button == 3:
                    if 287 <= testrect.x < 360:
                        for i in range(len(objetinventairerect)):
                            if testrect.colliderect(
                                    objetinventairerect[i]) and tune >= int(
                                        prix[i][0]):
                                achatfi = open("save1/inventaire", "r")
                                inventairestr = achatfi.read()
                                achatfi.close()
                                tune -= int(prix[i][0])
                                orfi = open("save1/invent/cpic", "w")
                                orfi.write(str(tune))
                                orfi.close()
                                bandeauhaut = pygame.image.load(
                                    "menu/inventory/bandeaumoney+quete.png"
                                ).convert_alpha()
                                achat[i][1] += 1
                                fi = open("save1/objet/" + achatstr[i], "w")
                                fi.write(str(achat[i][1]))
                                fi.close()
                                objetinventaireimage[i] = pygame.image.load(
                                    "menu/inventory/objetinventaire.png"
                                ).convert_alpha()
                                if achatstr[i] not in inventairestr:
                                    inventairestr += "," + str(achatstr[i])
                                    with open("save1/inventaire",
                                              "w") as fichier:
                                        fichier.write(inventairestr)
                if event.button == 5:
                    if 287 <= testrect.x and 160 <= testrect.y and curseurrect.y < 558:
                        curseurrect.y += (99 / 1.5)
                        for i in range(len(objetinventairerect)):
                            objetinventairerect[i][1] -= 98
                if event.button == 4:
                    if 287 <= testrect.x and testrect.y >= 160 > objetinventairerect[
                            0][1]:
                        curseurrect.y -= (98 / 1.5)
                        for i in range(len(objetinventairerect)):
                            objetinventairerect[i][1] += 98

            if event.type == MOUSEBUTTONUP:
                follow = False

        fenetre.blit(fond, (0, 0))
        fenetre.blit(bandeauhaut, (0, 0))
        fenetre.blit(interfaceinvent, (288, 70))
        for i in range(len(achat)):
            if objetinventairerect[i][1] >= 150:
                fenetre.blit(objetinventaireimage[i], objetinventairerect[i])
        if follow:
            if 558 >= curseurrect.y >= 145:
                savecurseur = curseurrect.y
                curseurrect.y = testrect.y
            if 558 > curseurrect.y > 145:
                for i in range(len(objetinventairerect)):
                    objetinventairerect[i][1] += 1.5 * (savecurseur -
                                                        curseurrect.y)
        if curseurrect.y <= 145:
            for i in range(len(objetinventairerect)):
                objetinventairerect[i][1] = 160 + 99 * i
        if curseurrect.y > 558:
            curseurrect.y = 558
        if curseurrect.y < 145:
            curseurrect.y = 145

        for i in range(len(achat)):
            objetinventaireimage[i].blit(inventaireimage, (0, 0))
            objetinventaireimage[i].blit(achat[i][0], (10, 8))
            objetinventaireimage[i].blit(
                police.render("Quantitée sac : " + str(achat[i][1]), True,
                              (0, 0, 0)), (195, 10))
            objetinventaireimage[i].blit(
                police.render("Prix : " + str(prix[i][0]), True, (0, 0, 0)),
                (95, 10))

        lior = list(str(tune))
        lior.reverse()
        for i in range(len(lior)):
            bandeauhaut.blit(listechiffre[int(lior[i])], (720 - 22 * i, 5))
        lior.reverse()

        fenetre.blit(curseur, curseurrect)
        pygame.display.flip()
Exemplo n.º 10
0
def invent():
    """Fonction qui affiche l'inventaire du perso"""
    ouverture.play()
    fond = pygame.image.load("menu/inventory/fond.jpg").convert()  # On met en fond un screen de la situation a cause de l'alpha très important
    follow = False
    curseurrect.x = 769  # Position curseur
    curseurrect.y = 145
    inventairefi = open("save1/inventaire", "r")
    objetinventaireimage = []
    inventairestr = inventairefi.read().split(",")  # fichier liste des objets
    for i in range(10):
        objetinventaireimage.append(
            pygame.image.load("menu/inventory/objetinventaire.png").convert_alpha())  # On leur attribut leeurs images
        objetinventairerect.append(Rect(287, 160 + 99 * i, 461, 98))
    bandeauhaut = pygame.image.load("menu/inventory/bandeaumoney+quete.png").convert_alpha()
    inventairefi.close()
    inventaire = []
    for i in range(len(inventairestr)):
        inventaire.append([inventairestr[i]])
        for j in range(len(inventaire)):
            fi = open("save1/objet/" + inventaire[i][0], "r")  # On attribut a chaque objet son nombre
            inventaire[i].append(int(fi.read()))
            fi.close()
            if inventaire[i][1] == 0 and inventairestr[i]:
                print(inventaire)
                print(inventairestr)
                deleteitem(inventairestr[i])
    for i in range(len(inventaire)):
        inventaire[i][0] = pygame.image.load("menu/inventory/objets/" + inventaire[i][
            0] + ".png").convert_alpha()  # On remplace le nom par l'image dans le tableau
    quetefi = open("menu/quetes/active", "r")
    queteactive = quetefi.read()
    queteactive = queteactive.capitalize()  # Quete active à afficher
    inventairemask = []  # mask des objets
    inventairerect = []  # position des objets
    for i in range(len(inventaire)):
        inventairemask.append(pygame.mask.from_surface(inventaire[i][0]))
    quetefi.close()
    if queteactive != "":
        missionfi = open("menu/quetes/" + queteactive + "/toprint")
        mission = missionfi.read()  # Objectif de la quête
        missionfi.close()
    orfi = open("save1/invent/cpic", "r")  # nombre d'or
    stror = orfi.read()
    orfi.close()
    lior = list(stror)
    lior.reverse()
    inc = 0
    emplacementperso = emplacementperso0  # animation de l'emplacement avec le skin perso
    onglet = ongletli[0]
    with open("save1/activation/perso3") as persounlock:
        persounlock = bool(int(persounlock.read()))
    pourcentpv1=int(perso_joueur.vie/perso_joueur.viemax*100)
    pourcentpv2=int(david.vie/david.viemax*100)
    if persounlock:
        pourcentpv3=int(sinatra.vie/sinatra.viemax*100)
    nvp1=perso_joueur.niveau
    xpp1=perso_joueur.xp
    pourcentxp1=int((xpp1/(nvp1*50))*100)
    lisnv=list(str(nvp1))
    if persounlock:
        stuff_actuel=stuff_actuel_2
    else:
        stuff_actuel=stuff_actuel_1
    while 1:
        for event in pygame.event.get():
            if event.type == QUIT:
                closemenu.closemenu()
            if event.type == KEYDOWN:
                if event.key == K_i:
                    fermeture.play()
                    suitef = open("save1\inventsave.rtvl", "w")
                    suitef.write("invent")  # On quitte l'inventaire
                    suitef.close()
                    return "return"

                if event.key == K_DOWN and curseurrect.y < 558:
                    curseurrect.y += 99 / 1.5 / len(inventaire)  # On baisse le curseur
                    for i in range(len(objetinventairerect)):
                        objetinventairerect[i][1] -= 98 / 1.5 / len(inventaire)

                if event.key == K_UP and objetinventairerect[0][1] < 160:
                    curseurrect.y -= 98 / 1.5 / len(inventaire)  # on monte l'inventaire
                    for i in range(len(objetinventairerect)):
                        objetinventairerect[i][1] += 98 / 1.5 / len(inventaire)
                if event.key == K_TAB:
                    arbre.arbre_compet()
            if event.type == MOUSEMOTION:
                testrect.x = event.pos[0]
                testrect.y = event.pos[1]  # on capture les positions de la souris et on l'attribut au pixel test
            if event.type == MOUSEBUTTONDOWN:
                if 630 < testrect.x < 802 and 90 < testrect.y < 110:
                    return "quete"  # on passe au menu quete
                if testmask.overlap(curseurmask, (curseurrect.x - testrect.x, curseurrect.y - testrect.y)):
                    follow = True  # le curseur prend le y de la souris
                if event.button == 3:
                    if 287 <= testrect.x < 360:
                        for i in range(len(objetinventairerect)):
                            if testrect.colliderect(objetinventairerect[i]) and inventaire[i][1] > 0:  # Si on touche un objet clique droit et qu'on a a plus de 0

                                inventairefi = open("save1/inventaire", "r")
                                inventairestr = inventairefi.read().split(",")
                                inventairefi.close()
                                if inventairestr[i] in consommable:  # Si c'est dans consommable
                                    reste = Item.item[inventairestr[i]]()#action de l'item
                                    if reste :
                                        sounditem.play()
                                        inventaire[i][1] -= 1  # on consomme
                                        pourcentpv1 = int(perso_joueur.vie / perso_joueur.viemax * 100)
                                        fi = open("save1/objet/" + inventairestr[i], "w")
                                        fi.write(str(inventaire[i][1]))  # on écrit dans la sauvegarde le nouveau nombre de l'objet
                                        fi.close()
                                        objetinventaireimage[i] = pygame.image.load(
                                            "menu/inventory/objetinventaire.png").convert_alpha()  # On raffraichis la surface
                                        if inventaire[i][1]==0:
                                            deleteitem(inventairestr[i])

                if event.button == 5:
                    if 287 <= testrect.x and 160 <= testrect.y and curseurrect.y < 558:
                        curseurrect.y += 99 / 1.5 / len(inventaire)  # Curseur on descend
                        for i in range(len(objetinventairerect)):
                            objetinventairerect[i][1] -= 98 / 1.5 / len(inventaire)
                if event.button == 4:
                    if 287 <= testrect.x and testrect.y >= 160 > objetinventairerect[0][1]:
                        curseurrect.y -= 98 / 1.5 / len(inventaire)  # Curseur on monte
                        for i in range(len(objetinventairerect)):
                            objetinventairerect[i][1] += 98 / 1.5 / len(inventaire)

            if event.type == MOUSEBUTTONUP:
                follow = False  # si on releve la souris le curseur suis plus

        inc += 1  # on increment la boucle animation
        # On anime
        if inc == 30:
            emplacementperso = emplacementperso0
        elif inc == 60:
            emplacementperso = emplacementperso1
        elif inc == 90:
            emplacementperso = emplacementperso2
            inc = 0  # on remet la boucle

        # Blit des différentes images
        fenetre.blit(fond, (0, 0))

        for i in range (pourcentpv1):
            if 50+2*i<239:
                fenetre.blit(portionvie, (50+2*i,531))
        for i in range (pourcentpv2):
            if 50+2*i<239:
                fenetre.blit(portionvie, (50+2*i,422))
        if persounlock:
            for i in range(pourcentpv3):
                if 50 + 2 * i < 239:
                    fenetre.blit(portionvie, (50 + 2 * i, 313))
        for i in range (pourcentxp1):
            if 50+2*i<239:
                fenetre.blit(portionxp, (35+2*i,587))

        fenetre.blit(emplacementperso, (0, 70))
        emplacementperso.blit(perso0, (75, 75))
        fenetre.blit(bandeauhaut, (0, 0))
        fenetre.blit(interfaceinvent, (288, 70))
        interfaceinvent.blit(onglet, (0, 18))
        fenetre.blit(stuff_actuel, (0, 263))
        fenetre.blit(police.render(str(perso_joueur.vie) + " / " + str(perso_joueur.viemax), True, (0, 0, 0)),
                     (50, 510))
        fenetre.blit(police.render(str(david.vie) + " / " + str(david.viemax), True, (0, 0, 0)), (50, 401))
        if persounlock:
            fenetre.blit(police.render(str(sinatra.vie)+ "/" + str(sinatra.viemax), True, (0,0,0)), (50, 292))
        for i in range (len(lisnv)):
            fenetre.blit(listechiffre_miniature[int(lisnv[i])], (23+4*i, 588))
        for i in range (len(str(xpp1))):
            fenetre.blit(listechiffre_miniature[int(list(str(xpp1))[i])], (37+5*i,588))
        fenetre.blit(slash, (37+5*(i+1), 588))
        for j in range (len(str(nvp1*50))):
            fenetre.blit(listechiffre_miniature[int(list(str(nvp1*50))[j])], (37+5*(i+2)+5*j,588))
        for i in range(len(inventaire)):
            if objetinventairerect[i][1] >= 150:
                fenetre.blit(objetinventaireimage[i], objetinventairerect[i])

        if follow:  # Si on suis le curseur
            if 558 >= curseurrect.y >= 145:
                savecurseur = curseurrect.y
                curseurrect.y = testrect.y
            if 558 > curseurrect.y > 145:
                for i in range(len(objetinventairerect)):
                    objetinventairerect[i][1] += 1.5 * (savecurseur - curseurrect.y) / len(inventaire)
        if curseurrect.y <= 145:  # On repositionne l'inventaire pour eviter les decalages si le curseur est en haut
            for i in range(len(objetinventairerect)):
                objetinventairerect[i][1] = 160 + 99 * i
        if curseurrect.y > 558:
            curseurrect.y = 558  # on repositionne le curseur si il sort de sa barre
        if curseurrect.y < 145:
            curseurrect.y = 145
        bandeauhaut = pygame.image.load("menu/inventory/bandeaumoney+quete.png").convert_alpha()  # On raffraichis la barre
        if queteactive != "":  # Si il y a une quete, on blit la description
            if queteactive != "Jeanma":
                bandeauhaut.blit(police.render(queteactive + " : " + mission, True, (53, 255, 251)), (10, 10))
            else:
                bandeauhaut.blit(police.render("Histoire" + " : " + mission, True, (53, 255, 251)), (10, 10))

        for i in range(len(inventaire)):  # On affiche la description des objets
            objetinventaireimage[i].blit(inventaire[i][0], (10, 8))
            objetinventaireimage[i].blit(police.render("Quantitée : " + str(inventaire[i][1]), False, (0, 0, 0)),
                                         (95, 10))
        for i in range(len(lior)):
            bandeauhaut.blit(listechiffre[int(lior[i])], (720 - 22 * i, 5))

        fenetre.blit(curseur, curseurrect)
        pygame.display.flip()
Exemplo n.º 11
0
def queteinv():
    ouverture.play()
    """ Fonction qui affiche la liste des quêtes """
    fond = pygame.image.load("menu/inventory/fond.jpg").convert()
    follow = False
    curseurrect.x = 769
    curseurrect.y = 145
    quetefi = open("menu/quetes/liste", "r")
    objetqueteimage = []
    objetqueterect = []
    quetestr = quetefi.read().split(",")
    for i in range(len(quetestr)):
        objetqueteimage.append(pygame.image.load("menu/inventory/objetinventaire.png").convert_alpha())
        objetqueterect.append(Rect(287, 160 + 99 * i, 461, 98))
    bandeauhaut = pygame.image.load("menu/inventory/bandeaumoney+quete.png").convert_alpha()
    quetefi.close()
    quete = []
    for i in range(len(quetestr)):
        quete.append([quetestr[i]])
    quetefi = open("menu/quetes/active", "r")
    queteactive = quetefi.read()
    queteactive = queteactive.capitalize()
    quetemask = []
    queterect = []
    quetefi.close()
    if queteactive != "":
        missionfi = open("menu/quetes/" + queteactive + "/toprint")
        mission = missionfi.read()
        missionfi.close()
    orfi = open("save1/invent/cpic", "r")
    stror = orfi.read()
    orfi.close()
    lior = list(stror)
    lior.reverse()
    inc = 0
    emplacementperso = emplacementperso0
    onglet = ongletli[2]
    pourcentpv1=int(perso_joueur.vie/perso_joueur.viemax*100)
    pourcentpv2=int(david.vie/david.viemax*100)
    nvp1 = perso_joueur.niveau
    xpp1 = perso_joueur.xp
    pourcentxp1=int((xpp1/(nvp1*50))*100)
    lisnv=list(str(nvp1))
    with open("save1/activation/perso3") as persounlock:
        persounlock = bool(int(persounlock.read()))
    if persounlock:
        stuff_actuel=stuff_actuel_2
    else:
        stuff_actuel=stuff_actuel_1
    while 1:
        for event in pygame.event.get():
            if event.type == QUIT:
                closemenu.closemenu()
            if event.type == KEYDOWN:
                if event.key == K_i:
                    suitef = open("save1\inventsave.rtvl", "w")
                    suitef.write("quete")
                    suitef.close()
                    fermeture.play()
                    return "return"

                if event.key == K_DOWN and curseurrect.y < 558:
                    curseurrect.y += 99 / 1.5 / len(quete)
                    for i in range(len(objetqueterect)):
                        objetqueterect[i][1] -= 98 / 1.5 / len(quete)

                if event.key == K_UP and objetqueterect[0][1] < 160:
                    curseurrect.y -= 98 / 1.5 / len(quete)
                    for i in range(len(objetqueterect)):
                        objetqueterect[i][1] += 98 / 1.5 / len(quete)
                if event.key == K_TAB:
                    arbre.arbre_compet()
            if event.type == MOUSEMOTION:
                testrect.x = event.pos[0]
                testrect.y = event.pos[1]
            if event.type == MOUSEBUTTONDOWN:
                if event.button == 1:
                    if 288 < testrect.x < 458 and 90 < testrect.y < 110:
                        return "invent"
                if testmask.overlap(curseurmask, (curseurrect.x - testrect.x, curseurrect.y - testrect.y)):
                    follow = True
                if event.button == 3:
                    for i in range(len(objetqueterect)):
                        if testrect.colliderect(objetqueterect[i]):
                            quetefi = open("menu/quetes/active", "w")
                            quetefi.write(quete[i][0])
                            quetefi.close()

                if event.button == 5:
                    if 287 <= testrect.x and 160 <= testrect.y and curseurrect.y < 558:
                        curseurrect.y += 99 / 1.5 / len(quete)
                        for i in range(len(objetqueterect)):
                            objetqueterect[i][1] -= 98 / 1.5 / len(quete)
                if event.button == 4:
                    if 287 <= testrect.x and testrect.y >= 160 > objetqueterect[0][1]:
                        curseurrect.y -= 98 / 1.5 / len(quete)
                        for i in range(len(objetqueterect)):
                            objetqueterect[i][1] += 98 / 1.5 / len(quete)

            if event.type == MOUSEBUTTONUP:
                follow = False
        vie = 9
        # fenetre.blit(Rect(51,531,189,6))
        inc += 1

        if inc == 30:
            emplacementperso = emplacementperso0
        elif inc == 60:
            emplacementperso = emplacementperso1
        elif inc == 90:
            emplacementperso = emplacementperso2
            inc = 0
        fenetre.blit(fond, (0, 0))
        for i in range (pourcentpv1):
            if 50+2*i<239:
                fenetre.blit(portionvie, (50+2*i,531))
        for i in range (pourcentpv2):
            if 50+2*i<239:
                fenetre.blit(portionvie, (50+2*i,422))
        for i in range (pourcentxp1):
            if 50+2*i<239:
                fenetre.blit(portionxp, (35+2*i,587))


        fenetre.blit(emplacementperso, (0, 70))
        emplacementperso.blit(perso0, (75, 75))
        fenetre.blit(bandeauhaut, (0, 0))
        fenetre.blit(interfaceinvent, (288, 70))
        interfaceinvent.blit(onglet, (0, 18))
        fenetre.blit(stuff_actuel, (0, 263))
        fenetre.blit(police.render(str(perso_joueur.vie)+" / "+str(perso_joueur.viemax), True, (0, 0, 0)), (50, 510))
        fenetre.blit(police.render(str(david.vie) +" / "+str(david.viemax) , True, (0, 0, 0)), (50, 401))
        for i in range (len(lisnv)):
            fenetre.blit(listechiffre_miniature[int(lisnv[i])], (23+4*i, 588))
        for i in range (len(str(xpp1))):
            fenetre.blit(listechiffre_miniature[int(list(str(xpp1))[i])], (37+5*i,588))
        fenetre.blit(slash, (37+5*(i+1), 588))
        for j in range (len(str(nvp1*50))):
            fenetre.blit(listechiffre_miniature[int(list(str(nvp1*50))[j])], (37+5*(i+2)+5*j,588))
        for i in range(len(quete)):
            if objetqueterect[i][1] >= 150:
                fenetre.blit(objetqueteimage[i], objetqueterect[i])
        if follow:
            if 558 >= curseurrect.y >= 145:
                savecurseur = curseurrect.y
                curseurrect.y = testrect.y
            if 558 > curseurrect.y > 145:
                for i in range(len(objetqueterect)):
                    objetqueterect[i][1] += 1.5 * (savecurseur - curseurrect.y) / len(quete)
        if curseurrect.y <= 145:
            for i in range(len(objetqueterect)):
                objetqueterect[i][1] = 160 + 99 * i
        if curseurrect.y > 558:
            curseurrect.y = 558
        if curseurrect.y < 145:
            curseurrect.y = 145
        bandeauhaut = pygame.image.load("menu/inventory/bandeaumoney+quete.png").convert_alpha()
        if queteactive != "":
            missionfi = open("menu/quetes/" + queteactive + "/toprint")
            mission = missionfi.read()
            missionfi.close()
        if queteactive != "":
            if queteactive!="Jeanma":
                bandeauhaut.blit(police.render(queteactive + " : " + mission, True, (53, 255, 251)), (10, 10))
            else:
                bandeauhaut.blit(police.render("Histoire" + " : " + mission, True, (53, 255, 251)), (10, 10))

        for i in range(len(quete)):
            quetefi = open("menu/quetes/active", "r")
            queteactive = quetefi.read()
            queteactive = queteactive.capitalize()
            objetqueteimage[i] = pygame.image.load("menu/inventory/objetinventaire.png").convert_alpha()
            toprintfi = open("menu/quetes/" + quete[i][0] + "/toprint")
            toprint = toprintfi.read()
            toprintfi.close()
            if quete[i][0]!="jeanma":
                objetqueteimage[i].blit(police.render(quete[i][0].capitalize(), True, (0, 0, 0)), (10, 10))
            else:
                objetqueteimage[i].blit(police.render("Histoire", True, (0, 0, 0)), (10, 10))
            objetqueteimage[i].blit(police.render("Objectif: " + toprint, True, (0, 0, 0)), (10, 30))
            if quete[i][0].capitalize() == queteactive:
                objetqueteimage[i].blit(
                    police.render("Active", True, (0, 0, 0)), (10, 50))
        for i in range(len(lior)):
            bandeauhaut.blit(listechiffre[int(lior[i])], (720 - 22 * i, 5))


        fenetre.blit(curseur, curseurrect)
        pygame.display.flip()
Exemplo n.º 12
0
def arbre_compet():
    bouclier = pygame.image.load("menu/competance/compdef.png").convert_alpha()
    boucliermask = pygame.mask.from_surface(bouclier)
    coeur = pygame.image.load("menu/competance/compvie.png").convert_alpha()
    coeurmask = pygame.mask.from_surface(coeur)
    degat = pygame.image.load("menu/competance/compatk.png").convert_alpha()
    degatmask = pygame.mask.from_surface(degat)
    coeur1 = pygame.image.load("menu/competance/compvie.png").convert_alpha()
    coeurmask1 = pygame.mask.from_surface(coeur1)
    degat1 = pygame.image.load("menu/competance/compatk.png").convert_alpha()
    degatmask1 = pygame.mask.from_surface(degat1)
    coeur2 = pygame.image.load("menu/competance/compvie.png").convert_alpha()
    coeurmask2 = pygame.mask.from_surface(coeur2)
    degat2 = pygame.image.load("menu/competance/compatk.png").convert_alpha()
    degatmask2 = pygame.mask.from_surface(degat2)
    mana = pygame.image.load("menu/competance/compfire.png").convert_alpha()
    manamask = pygame.mask.from_surface(mana)
    poison = pygame.image.load("menu/competance/compdodge.png").convert_alpha()
    poisonmask = pygame.mask.from_surface(poison)
    perso0 = pygame.image.load("menu/competance/teteperso0.png").convert_alpha()
    perso1 = pygame.image.load("menu/competance/teteperso1.png").convert_alpha()
    perso2 = pygame.image.load("menu/competance/teteperso2.png").convert_alpha()

    test = pygame.image.load("launcher/pixelgitan.png").convert_alpha()
    mask = pygame.mask.from_surface(test)
    clock = pygame.time.Clock()
    perso="joueur"
    fond = pygame.image.load("menu/competance/arbrecomp.png").convert_alpha()
    fond2=pygame.image.load("menu/inventory/fond.jpg").convert()
    x=0
    y=0
    with open("save1/activation/perso3", "r") as active:
        sinatra.active = bool(int(active.read()))

    while 1:
        save = open("save1/save", "r")
        save.close()
        for event in pygame.event.get():
            if event.type == QUIT:  # pour pouvoir quitter le jeux
                closemenu.closemenu()
            if event.type == KEYDOWN:  # les deplacements
                if event.key == K_ESCAPE:
                    return
                if event.key == K_TAB:
                    savetpt()
                    return
            if event.type == MOUSEMOTION:  # Si mouvement de souris
                x = event.pos[0]
                y = event.pos[1]
            if event.type == MOUSEBUTTONDOWN and event.button == 1:
                if clique == 1 and perso_joueur.ptdecompetance>=1:
                    perso_joueur.ptdecompetance -= 1
                    perso_joueur.ptvie += 1
                    perso_joueur.viemax += 20
                    perso_joueur.vie += 20
                if clique == 2 and perso_joueur.ptdecompetance>=3:
                    perso_joueur.ptdecompetance -= 3
                    perso_joueur.ptmana += 1
                    perso_joueur.sortdefeu = True
                if clique == 3 and perso_joueur.ptdecompetance>=1:
                    perso_joueur.ptdecompetance -= 1
                    perso_joueur.ptforce += 1
                if clique == 4 and david.ptdecompetance>=1:
                    david.ptdecompetance -= 1
                    david.ptvie +=1
                    david.viemax += 20
                    david.vie += 20
                if clique == 5 and david.ptdecompetance>=1:
                    david.ptdecompetance -= 1
                    david.ptforce += 1
                if clique == 6 and david.ptdecompetance>=3:
                    david.ptdecompetance -= 3
                    david.ptbouclier += 1
                if clique == 7 and sinatra.active==True and sinatra.ptdecompetance>=1:
                    sinatra.ptdecompetance -= 1
                    sinatra.ptvie += 1
                    sinatra.viemax += 20
                    sinatra.vie += 20
                if clique == 8 and sinatra.active==True and sinatra.ptdecompetance>=3:
                    sinatra.ptdecompetance -= 3
                    sinatra.ptdodge += 1
                if clique == 9 and sinatra.active == True and sinatra.ptdecompetance>=1:
                    sinatra.ptdecompetance -= 1
                    sinatra.ptforce += 1
        fenetre.blit(fond2, (0,0))
        fenetre.blit(fond, (0, 0))
        fenetre.blit(mana, (360, 312))
        fenetre.blit(coeur, (237, 220))
        fenetre.blit(degat, (483, 220))
        fenetre.blit(coeur1, (29, 53))
        fenetre.blit(degat1, (29, 481))
        fenetre.blit(coeur2, (691, 53))
        fenetre.blit(degat2, (691, 481))
        fenetre.blit(bouclier, (243, 437))
        fenetre.blit(poison, (477, 437))
        fenetre.blit(perso1, (95,311))
        fenetre.blit(perso0, (356, 79))
        fenetre.blit(perso2, (617,311))
        fenetre.blit(police.render(str(perso_joueur.ptmana), False, (0, 0, 188)), (360, 297))
        fenetre.blit(police.render(str(perso_joueur.ptvie), False, (0, 0, 188)), (237, 205))
        fenetre.blit(police.render(str(perso_joueur.ptforce), False, (0, 0, 188)), (483, 205))
        fenetre.blit(police.render(str(david.ptbouclier), False, (0, 0, 188)), (243, 422))
        fenetre.blit(police.render(str(david.ptvie), False, (0, 0, 188)), (29, 38))
        fenetre.blit(police.render(str(david.ptforce), False, (0, 0, 188)), (29, 466))
        fenetre.blit(police.render(str(sinatra.ptdodge), False, (0, 0, 188)), (477, 422))
        fenetre.blit(police.render(str(sinatra.ptvie), False, (0, 0, 188)), (691, 38))
        fenetre.blit(police.render(str(sinatra.ptforce), False, (0, 0, 188)), (691, 466))
        lior = list(str(perso_joueur.ptdecompetance))
        lior.reverse()
        for i in range(len(lior)):
            fenetre.blit(listechiffre[int(lior[i])], (400-20*i, 30))
        lior = list(str(david.ptdecompetance))
        lior.reverse()
        for i in range(len(lior)):
            fenetre.blit(listechiffre[int(lior[i])], (80 - 20 * i, 325))
        lior = list(str(sinatra.ptdecompetance))
        lior.reverse()
        for i in range(len(lior)):
            fenetre.blit(listechiffre[int(lior[i])], (730 - 20 * i, 325))

        if mask.overlap(coeurmask, (237-x, 220-y)):
                clique=1
        elif mask.overlap(manamask, (360-x, 312-y)):
                clique = 2
        elif mask.overlap(degatmask, (483-x, 220-y)):
                clique = 3
        elif mask.overlap(coeurmask1, (29-x, 53-y)):
                clique = 4
        elif mask.overlap(degatmask1, (29-x, 481-y)):
                clique = 5
        elif mask.overlap(boucliermask, (243-x, 437-y)):
                clique=6
        elif mask.overlap(coeurmask2, (691-x, 53-y)):
                clique = 7
        elif mask.overlap(poisonmask, (477-x, 437-y)):
                clique = 8
        elif mask.overlap(degatmask2, (691-x, 481-y)):
                clique = 9
        else:
                clique = 0




        clock.tick(60)
        pygame.display.flip()
Exemplo n.º 13
0
    def affichageanim(self, d):
        fichier = open("save1/map", "r")
        map = fichier.read()
        fichier.close()

        if map == "capitale":
            fond = pygame.image.load("battle/Battlebacks/009-CastleTown01.jpg")
        elif map == "chateau_3F":
            fond = pygame.image.load("battle/Battlebacks/026-Castle02.jpg")
        elif map == "caverne":
            fond = pygame.image.load("battle/Battlebacks/043-Cave01.jpg")
        elif map == "mapdepart":
            fond = pygame.image.load("battle/Battlebacks/005-Beach01.jpg")
        elif "fjord" in map:
            fond = pygame.image.load(
                "battle/Battlebacks/icecave.png").convert_alpha()
        elif map == "village":
            fond = pygame.image.load("battle/Battlebacks/003-Forest01.jpg")
        else:
            fond = pygame.image.load("battle/Battlebacks/043-Cave01.jpg")
        clock = pygame.time.Clock()
        my_font = pygame.font.SysFont("Calibri", 36)
        bandeaubleue = pygame.image.load(
            "battle/animation/Fightblue.png").convert_alpha()
        bandeaurouge = pygame.image.load(
            "battle/animation/Fightred.png").convert_alpha()
        fouldebeu = pygame.image.load(
            "battle/animation/fireball.png").convert_alpha()
        fouldebeunul = pygame.image.load(
            "battle/animation/fireballkitomb.png").convert_alpha()
        fleche = pygame.image.load(
            "battle/animation/fleche.png").convert_alpha()
        bouclier = pygame.image.load(
            "battle/animation/bouclier.png").convert_alpha()
        damage = pygame.mixer.Sound("son/bruit/Damage2.ogg")
        potion = pygame.mixer.Sound("son/bruit/Heal3.ogg")
        feu = pygame.mixer.Sound("son/bruit/Fire1.ogg")

        i = 0
        fenetre.blit(fond, (0, 0))
        while i < 42:
            for event in pygame.event.get():
                if event.type == QUIT:  # pour pouvoir quitter le jeux
                    closemenu.closemenu(fenetre)
            fenetre.blit(bandeaubleue, (811 - i * 10, 200))
            fenetre.blit(bandeaurouge, (-421 + i * 10, 200))
            i += 1
            clock.tick(60)
            pygame.display.flip()

        i = 0
        while i < 160:
            fenetre.blit(fond, (0, 0))
            for event in pygame.event.get():
                if event.type == QUIT:  # pour pouvoir quitter le jeux
                    closemenu.closemenu()
            fenetre.blit(bandeaubleue, (390, 200))
            fenetre.blit(bandeaurouge, (-1, 200))
            if combat.anim == 1 or combat.anim == 3 or combat.anim == 6 or combat.anim == 7 or combat.anim == 8:
                if combat.tour == 1:
                    fenetre.blit(perso_joueur.image, (689, 200))
                if combat.tour == 2:
                    fenetre.blit(david.image, (689, 200))
                if combat.tour == 3:
                    fenetre.blit(sinatra.image, (689, 200))
                fenetre.blit(enemitipe.image, (11, 200))
                if i < 80:
                    if combat.anim == 1:
                        fenetre.blit(fouldebeu, (689 - i * 6, 250))
                    elif combat.anim == 3:
                        fenetre.blit(fleche, (689 - i * 6, 250))
                    elif combat.anim == 6:
                        fenetre.blit(manap.imageanim, (640, 250 - i))
                    elif combat.anim == 7:
                        fenetre.blit(soin.imageanim, (640, 250 - i))
                    elif combat.anim == 8:
                        fenetre.blit(resurection.imageanim, (640, 250 - i))
                elif i == 80:
                    if combat.anim == 6 or combat.anim == 7 or combat.anim == 8:
                        potion.play()
                    if combat.anim == 1:
                        feu.play()

                else:
                    if combat.anim == 6:
                        fenetre.blit(my_font.render("50", 3, (0, 0, 200)),
                                     (680, 180))

                    elif combat.anim == 7:
                        fenetre.blit(my_font.render("50", 3, (0, 200, 0)),
                                     (680, 180))
                    elif combat.anim == 8:
                        fenetre.blit(
                            my_font.render("Les allié sont en vie", 3,
                                           (0, 200, 200)), (680, 180))
                    else:
                        fenetre.blit(my_font.render(str(d), 3, (255, 10, 10)),
                                     (41, 180))
                        damage.play()
            elif combat.anim == 2:
                fenetre.blit(perso_joueur.image, (689, 200))
                fenetre.blit(enemitipe.image, (11, 200))
                if i < 20:
                    fenetre.blit(fouldebeu, (689 - i * 6, 250))
                else:
                    fenetre.blit(fouldebeunul, (569, 250 + i * 2))
            elif combat.anim == 4:
                fenetre.blit(david.image, (689, 200))
            elif combat.anim == 5:
                fenetre.blit(david.image, (689, 200))
                fenetre.blit(bouclier, (689, 200))

            else:

                if i < 80:
                    if combat.tour == 1:
                        fenetre.blit(perso_joueur.image, (689 - i * 4, 200))
                    if combat.tour == 2:
                        fenetre.blit(david.image, (689 - i * 4, 200))
                    if combat.tour == 3:
                        fenetre.blit(sinatra.image, (689 - i * 4, 200))
                if i == 80:
                    damage.play()
                if i > 80:
                    if combat.tour == 1:
                        fenetre.blit(perso_joueur.image2, (289, 200))
                    if combat.tour == 2:
                        fenetre.blit(david.image2, (289, 200))
                    if combat.tour == 3:
                        fenetre.blit(sinatra.image2, (289, 200))
                    fenetre.blit(my_font.render(str(d), 3, (255, 10, 10)),
                                 (41, 180))

            fenetre.blit(enemitipe.image, (11, 200))

            clock.tick(60)
            pygame.display.flip()
            i += 1
Exemplo n.º 14
0
    def affichageanimennemi(self, d, varanim):
        fichier = open("save1/map", "r")
        map = fichier.read()
        fichier.close()

        if map == "capitale":
            fond = pygame.image.load("battle/Battlebacks/009-CastleTown01.jpg")
        elif map == "chateau_3F":
            fond = pygame.image.load("battle/Battlebacks/026-Castle02.jpg")
        elif map == "caverne":
            fond = pygame.image.load("battle/Battlebacks/043-Cave01.jpg")
        elif map == "mapdepart":
            fond = pygame.image.load("battle/Battlebacks/005-Beach01.jpg")
        elif "fjord" in map:
            fond = pygame.image.load(
                "battle/Battlebacks/icecave.png").convert_alpha()
        elif map == "village":
            fond = pygame.image.load("battle/Battlebacks/003-Forest01.jpg")
        else:
            fond = pygame.image.load("battle/Battlebacks/043-Cave01.jpg")
        clock = pygame.time.Clock()
        my_font = pygame.font.SysFont("Calibri", 36)
        bandeaubleue = pygame.image.load(
            "battle/animation/Fightblue.png").convert_alpha()
        bandeaurouge = pygame.image.load(
            "battle/animation/Fightred.png").convert_alpha()
        pointinterro = pygame.image.load(
            "battle/animation/pointintero.png").convert_alpha()
        feu = pygame.image.load("battle/animation/fire.png").convert_alpha()
        feus = pygame.mixer.Sound("son/bruit/Fire1.ogg")
        malediction = pygame.image.load(
            "battle/animation/malediction.png").convert_alpha()
        damage = pygame.mixer.Sound("son/bruit/Damage2.ogg")
        fenetre.blit(fond, (0, 0))
        for i in range(42):
            for event in pygame.event.get():
                if event.type == QUIT:  # pour pouvoir quitter le jeux
                    closemenu.closemenu()
            fenetre.blit(bandeaubleue, (811 - i * 10, 200))
            fenetre.blit(bandeaurouge, (-421 + i * 10, 200))
            i += 1
            clock.tick(60)
            pygame.display.flip()
        for i in range(160):
            for event in pygame.event.get():
                if event.type == QUIT:  # pour pouvoir quitter le jeux
                    closemenu.closemenu()
            fenetre.blit(bandeaubleue, (390, 200))
            fenetre.blit(bandeaurouge, (-1, 200))

            if i < 80:
                if varanim != 3 and varanim != 4 and varanim != 1:
                    if fennemi.p == 2 or david.taunt > 0:
                        fenetre.blit(david.image, (659, 200))
                    elif fennemi.p == 1:
                        fenetre.blit(perso_joueur.image, (659, 200))
                    elif fennemi.p == 3:
                        fenetre.blit(sinatra.image, (659, 200))
                if varanim == 1:
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(david.image, (625, 150))
                    fenetre.blit(perso_joueur.image, (610, 230))
                elif varanim == 2:
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(pointinterro, (11, 100))
                elif varanim == 3:
                    fenetre.blit(sinatra.image, (640, 70))
                    fenetre.blit(david.image, (625, 150))
                    fenetre.blit(perso_joueur.image, (610, 230))
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(feu, (600, 150))

                elif varanim == 4:
                    fenetre.blit(sinatra.image, (640, 70))
                    fenetre.blit(david.image, (625, 150))
                    fenetre.blit(perso_joueur.image, (610, 230))
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(malediction, (600, 150))
                elif varanim == 5:
                    fenetre.blit(enemitipe.image, (11, 200))
                elif varanim == 0:
                    fenetre.blit(enemitipe.image, (11 + i * 4, 200))
            if i == 80:
                if varanim == 0:
                    damage.play()
                if varanim == 3:
                    feus.play()
            if i > 80:
                if varanim != 3 and varanim != 4 and varanim != 1:
                    if fennemi.p == 2 or david.taunt > 0:
                        fenetre.blit(david.image, (689, 200))
                    elif fennemi.p == 1:
                        fenetre.blit(perso_joueur.image, (659, 200))
                    elif fennemi.p == 3:
                        fenetre.blit(sinatra.image, (659, 200))
                else:
                    if varanim != 1:
                        fenetre.blit(sinatra.image, (640, 70))
                        fenetre.blit(david.image, (625, 150))
                        fenetre.blit(perso_joueur.image, (610, 230))
                if varanim == 1:
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(david.image, (625, 150))
                    fenetre.blit(perso_joueur.image, (610, 230))
                    fenetre.blit(my_font.render("poison", 3, (0, 200, 10)),
                                 (659, 180))
                elif varanim == 2:
                    fenetre.blit(enemitipe.image, (11, 200))
                    if d > 0:
                        fenetre.blit(my_font.render(str(d), 3, (255, 10, 10)),
                                     (659, 180))
                    elif d < 0:
                        fenetre.blit(my_font.render(str(-d), 3, (10, 255, 10)),
                                     (659, 180))
                    elif d == 0:
                        fenetre.blit(my_font.render(str(d), 3, (10, 10, 10)),
                                     (659, 180))
                elif varanim == 3:
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(
                        my_font.render(str(d) + "*3", 3, (255, 10, 10)),
                        (659, 180))
                elif varanim == 4:
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(malediction, (600, 150))
                elif varanim == 5:
                    fenetre.blit(enemitipe.image, (11, 200))
                    fenetre.blit(my_font.render("1000", 3, (100, 255, 10)),
                                 (30, 180))
                elif varanim == 0:
                    fenetre.blit(my_font.render(str(d), 3, (255, 10, 10)),
                                 (659, 180))
                    fenetre.blit(enemitipe.image, (411, 200))

            clock.tick(60)
            pygame.display.flip()