carre.py

Created by gengisclan

Created on October 24, 2022

3.28 KB

Histoire : Essayez de survivre sans toucher le Chaos, ni les bords.
Gagner des points :


#x=320|y=222
from time import *
from ion import *
from kandinsky import *
from random import *
Invincible=False #Chuuuuuuuuuuuuuuut
Seconde=0
Score=0
Temps=0
Attente=0
Minute=0
NV=500
x=150
y=101
BLANC=color(255,255,255)
ROUGE_FR=color(239,65,53)
CHAOS=color(0,0,0)
BOUCLIER=color(127,0,255)
fill_rect(x,y,10,10,ROUGE_FR)
Run=True
while Run==True:
  if keydown(KEY_IMAGINARY):
    if keydown(KEY_SQUARE):
      if keydown(KEY_SINE):
        Invincible=True #Chuuuuuut
        draw_string("Invincible !",0,20);Score=0;Seconde=0;Attente=0;Temps=0;sleep(.1);fill_rect(0,0,320,222,BLANC);fill_rect(x,y,10,10,BLANC);fill_rect(x,y,10,10,ROUGE_FR);draw_string("            ",0,20)
  if Seconde==60:
    Minute+=1
    Seconde=0
  if Minute==0:
    draw_string(str(Seconde)+" s",0,0)
  else:
    draw_string(str(Minute)+" min "+str(Seconde)+" s",0,0)
  Temps+=1
  if Minute==1:
    Run=False
    print("YOU WIN !")
    Score+=1000
    if Score<0:
      Score=0
  if Temps==170:
    Score+=1
    Seconde+=1
    Attente+=1
    Temps=0
    if Attente==10:
      NV/=2.75 #Vitesse de jeu
      CHAOS=color(0,0,0)
      for i in range(3):
        draw_string("Next Round !",0,20)
        sleep(.1)
        draw_string("            ",0,20)
        sleep(.1)
      fill_rect(0,0,320,222,BLANC)
      fill_rect(x,y,10,10,BLANC)
      fill_rect(x,y,10,10,ROUGE_FR)
      Attente=0
  Apparition=randint(0,int(NV))
  Item=randint(0,1000)
  if Apparition==0:
    fill_rect(randint(0,320),randint(0,222),20,20,CHAOS)
    fill_rect(x,y,10,10,ROUGE_FR)
    Score+=1
  if Item==10:
    fill_rect(randint(0,320),randint(0,222),15,15,BOUCLIER)
    fill_rect(x,y,10,10,ROUGE_FR)
  
  if keydown(KEY_UP):
    Verif=get_pixel(x+6,y-1)
    if Verif==color(0,0,0):
      if Invincible!=True:
        Run=False
        print("GAME OVER !")
    if Verif==(120, 0, 248):
      Score+=100
      CHAOS=color(0,255,0)
      fill_rect(x-8,y,26,-15,BLANC)
    fill_rect(x,y,10,10,BLANC)
    fill_rect(x,y-1,10,10,ROUGE_FR)
    Score+=1
    y-=1
  if keydown(KEY_DOWN):
    Verif=get_pixel(x+6,y+11)
    if Verif==color(0,0,0):
      if Invincible!=True:
        Run=False
        print("GAME OVER !")
    if Verif==(120, 0, 248):
      Score+=100
      CHAOS=color(0,255,0)
      fill_rect(x-8,y+10,26,16,BLANC)
    fill_rect(x,y,10,10,BLANC)
    fill_rect(x,y+1,10,10,ROUGE_FR)
    Score+=1
    y+=1
  if keydown(KEY_LEFT):
    Verif=get_pixel(x-1,y+6)
    if Verif==color(0,0,0):
      if Invincible!=True:
        Run=False
        print("GAME OVER !")
    if Verif==(120, 0, 248):
      Score+=100
      CHAOS=color(0,255,0)
      fill_rect(x,y-8,-15,26,BLANC)
    fill_rect(x,y,10,10,BLANC)
    fill_rect(x-1,y,10,10,ROUGE_FR)
    Score+=1
    x-=1
  if keydown(KEY_RIGHT):
    Verif=get_pixel(x+11,y+6)
    if Verif==color(0,0,0):
      if Invincible!=True:
        Run=False
        print("GAME OVER !")
    if Verif==(120, 0, 248):
      Score+=100
      CHAOS=color(0,255,0)
      fill_rect(x+10,y-8,16,26,BLANC)
    fill_rect(x,y,10,10,BLANC)
    fill_rect(x+1,y,10,10,ROUGE_FR)
    Score+=1
    x+=1
  if keydown(KEY_OK):
    fill_rect(x,y,10,10,BLANC)
    x=150
    y=101
    fill_rect(x-10,y-10,30,30,BLANC)
    fill_rect(x,y,10,10,ROUGE_FR)
    Score-=10


if Score<0:
  Score=0
print("Score :",Score)
print("BEST Score : 12764")
print("BEST Score ""Hum Hum !"": 21897")

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.