1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| from tkinter import *
import random
#Base de la fenetre
fen = Tk()
fen.geometry("700x394")
fen.title("Projet ISN")
image = PhotoImage(file='fond.gif')
canvas = Canvas(fen, width=1, height=1)
canvas.pack(fill=BOTH, expand=1)
canvas.create_image(0, 0, image=image, anchor=NW)
#Fonction associé aux boutons
def C1 ():
"""Estoc"""
import random
valeur1 = random.randint (50,70)
PDV1=500
PDV2=500
if PDV2 >= 0 :
tour=1
PDV2=PDV2-valeur1
messagebox.showinfo("Points de vie restant au joueur 2",PDV2)
else:
messagebox.showinfo("joueur 2 a gagné")
def C2 ():
"""Purification"""
import random
valeur2 = random.randint (30,100)
PDV1=500
PDV2=500
if PDV2 >= 0 :
PDV2=PDV2-valeur2
messagebox.showinfo("Points de vie restant au joueur 2",PDV2)
else:
messagebox.showinfo("joueur 2 a gagné")
def C3 ():
"""Sacre divin"""
import random
valeur3 = random.randint (0,300)
PDV1=500
PDV2=500
if PDV2 >= 0 :
PDV2=PDV2-valeur3
messagebox.showinfo("Points de vie restant au joueur 2",PDV2)
else:
messagebox.showinfo("joueur 2 a gagné")
def C4 ():
"""Taillade"""
import random
valeur4 = random.randint (50,70)
PDV1=500
PDV2=500
if PDV1 >= 0 :
PDV1=PDV1-valeur4
messagebox.showinfo("Points de vie restant au joueur 1",PDV1)
else:
messagebox.showinfo("joueur 1 a gagné")
def C5 ():
"""Fracasseur"""
import random
valeur5 = random.randint (30,100)
PDV1=500
PDV2=500
if PDV1 >= 0 :
PDV1=PDV1-valeur5
messagebox.showinfo("Points de vie restant au joueur 1",PDV1)
else:
messagebox.showinfo("joueur 1 a gagné")
def C6 ():
"""Decapitation"""
import random
valeur6 = random.randint (0,300)
PDV1=500
PDV2=500
if PDV1 >= 0 :
PDV1=PDV1-valeur6
messagebox.showinfo("Points de vie restant au joueur 1",PDV1)
else:
messagebox.showinfo("joueur 1 a gagné")
#Boutons Joueur 1
L1=Label(fen,text="Joueur 1")
B1=Button(fen,text="Estoc",width=10,command=C1)
B2=Button(fen,text="Purification",width=10,command=C2)
B3=Button(fen,text="Sacre divin",width=10,command=C3)
#Boutons Joueur 2
L2=Label(fen,text="Joueur 2")
B4=Button(fen,text="Taillade",width=10,command=C4)
B5=Button(fen,text="Fracasseur",width=11,command=C5)
B6=Button(fen,text="Decapitation",width=9,command=C6)
#Emplacement des boutons Joueur 1
L1.place(x=100, y=10)
B1.place(x=10, y=350)
B2.place(x=100, y=350)
B3.place(x=190, y=350)
#Emplacement des boutons Joueur 2
L2.place(x=550, y=10)
B4.place(x=445, y=350)
B5.place(x=535, y=350)
B6.place(x=625, y=350)
#Première fenetre
messagebox.showinfo(
"Demon Soul",
"Bienvenue dans Demon Soul!\n\n"
"Ce jeu se joue au tour par tour. \n"
"Le joueur 1 contrôle un chevalier de la Lumière \n"
"Le joueur 2 contrôle un guerrier des Enfer \n"
"Chacun va choisir son attaque parmis 3 disponibles pour chaque personnage jusqu'a ce que mort s'en suive. \n\n"
"Tester votre chance ! "
)
fen.mainloop() |
Partager