top of page

État du code du projet

def setup():
   smooth()
   size(1000, 500)
   background(0,100,40)
   police=loadFont("Georgia-48.vlw")
   textFont(police,48)
   textSize(40)
   text("Bienvenue dans mon jeu de badminton",160,235)
   ellipse(480,300,240,70)
   textSize(30)
   fill(0,100,40)
   text("Commencer =>",385,310)
   global img
   img=loadImage("terrain1.png")
   global img2
   img2=loadImage("joueur.jpg")
   global commencer
   commencer=True
   global Bouton
   Bouton=True
   global fleche
   fleche=True

def draw():
   if commencer==True:
       if mouseButton == LEFT and mousePressed == True:
           if mouseX>350 and mouseX<600 and mouseY>200 and mouseY<400:
               global commencer
               commencer=False
               scene2()            
   if Bouton==True:
       bouton()
   if fleche==True:
       if mouseButton==LEFT and mousePressed==True:
           if mouseX<1000 and mouseX>800 and mouseY<600 and mouseY>400:
               global fleche
               fleche=False
               global Bouton
               Bouton=False
               scene3()
           
               
def scene2():
   background(0,100,40)
   strokeWeight(2)
   fill(200)
   rect(190,10,600,100) #choisis ton perso
   fill(150)
   femme=rect(190,120,290,100)
   homme=rect(500,120,290,100)
   fill(200)
   rect(190,250,600,100) #choisis ton niveau
   fill(150)
   facile=rect(190,360,190,100)
   moyen=rect(395,360,190,100)
   difficile=rect(600,360,190,100)
   textSize(50)
   fill(0)
   text("Choisis ton personnage",230,80)
   Tfemme=text("FEMME",240, 190)
   Thomme=text("HOMME",540,190)
   text("Choisis ton niveau de jeu",210,320)    
   textSize(37)
   Tfacile=text("FACILE",220,425)
   Tmoyen=text("MOYEN",425,425)
   Tdifficile=text("DIFFICILE",602,425)  
   textSize(70)
   fill(500,500,500)
   text("->",880,470)


def bouton():
   if mouseButton==LEFT and mousePressed==True:
       if mouseY>100 and mouseY<220:        
           if mouseX>190 and mouseX<500:
               fill(120)
               femme=rect(190,120,290,100)
               fill(0)
               textSize(50)
               Tfemme=text("FEMME",240, 190)
               fill(150)
               homme=rect(500,120,290,100)
               textSize(50)
               fill(0)
               Thomme=text("HOMME",540,190)
           if mouseX>500 and mouseX<800:
               fill(120)
               homme=rect(500,120,290,100)
               fill(0)
               textSize(50)
               Thomme=text("HOMME",540,190)
               fill(150)
               femme=rect(190,120,290,100)
               textSize(50)
               fill(0)
               Tfemme=text("FEMME",240, 190)
       if mouseY>350 and mouseY<470:
           if mouseX>190 and mouseX<380:
               fill(120)
               facile=rect(190,360,190,100)
               fill(0)
               textSize(37)
               Tfacile=text("FACILE",220,425)
               fill(150)
               moyen=rect(395,360,190,100)
               difficile=rect(600,360,190,100)
               fill(0)
               textSize(37)
               Tmoyen=text("MOYEN",425,425)
               Tdifficile=text("DIFFICILE",602,425)
           elif mouseX>400 and mouseX<590:
               fill(120)
               moyen=rect(395,360,190,100)
               fill(0)
               textSize(37)
               Tmoyen=text("MOYEN",425,425)
               fill(150)
               facile=rect(190,360,190,100)
               difficile=rect(600,360,190,100)
               fill(0)
               textSize(37)
               Tfacile=text("FACILE",220,425)
               Tdifficile=text("DIFFICILE",602,425)
           elif mouseX>600 and mouseX<790:
               fill(120)
               difficile=rect(600,360,190,100)
               fill(0)
               textSize(37)
               Tdifficile=text("DIFFICILE",602,425)
               fill(150)
               facile=rect(190,360,190,100)
               moyen=rect(395,360,190,100)
               fill(0)
               textSize(37)
               Tfacile=text("FACILE",220,425)
               Tmoyen=text("MOYEN",425,425)

def scene3():
   image(img,0,0,1000,500)
   fill(0)
   raquette=rect(55,mouseY,3,70)
   image(img2,750,120,200,260)
   
def mouseMoved():
   fill(0)
   raquette=rect(55,mouseY,3,70)

 

Eloïse NSI

© 2023 par Eloïse NSI . Créé avec Wix.com

bottom of page