escape.py

Created by chambounaudaubin

Created on October 10, 2025

7.26 KB

Reporter tous les bugs à chambounaudaubin@mail.com Informations pour passer les niveaux:
- coincer les monstres derrière des blocs en les contournant
- ils ne vous suivent plus des lors qu’ils sortent de votre champ de vision
- élaborez vos propres stratégies :)
En fonction de la puissance de votre calculatrice, choisissez la vitesse d’exécution. Appuyez sur OK pour passer au niveau suivant.


from time import *
from ion import *
from math import *
from kandinsky import *
niveaux=["""n000000050300200200255n050000350050200200255n250050150100200200255n150150250050200200255n450150250050200200255n400150050100200200255n650200050200200200255n500250050100200200255n350300150050200200255n250250100100200200255n250350100150200200255n350450350050200200255n000150050250200200255n050250100150200200255n000400050350200200255n050650250100200200255n150450050150200200255n200450050050200200255n250550025025200200255n350500050100200200255n300700300050200200255n500500150200200200255n700300250050200200255n900350050100200200255n800450150250200200255n750550050050200200255n800400020010200200255n150100020010200200255n650650150010000255000"""
,"n150250300050255255200n450250250050255255200n150300050400255255200n650300050400255255200n200650200050255255200n500650150050255255200n250350050250255255200n550350050250255255200n300550250050255255200n350400150050255255200n350450050050255255200n450450050050255255200n400450050010000255000"
,"n000500050150000255000n050500200050000255000n050600150050000255000n150650200050000255000n300600050050000255000n350600100050000255000n200000050350000255000n200350050150000255000n400350050300000255000n400000050350000255000n250050030050000255000n250200010050000255000n250350050050000255000n380350020050000255000n350200050050000255000n350050050050000255000n300525050030000255000n250000150010255255000"]
zbl=[1,1,1,2,2,2,2,3,3,3]
zbxa=[]
zbya=[]
xinit=[-292,-300,81]
yinit=[-415,-650,-470]
xf=0
yf=0
wf=0
hf=0
r=0
g=0
b=0
n=0
d=0
level=0
step=3
mov=0
ec=0
xp=148
yp=99
l=25
bg=(0,0,0)
fill_rect(0,0,320,222,color(bg))
colx=0
coly=0
go=1
pa=0
debut=1
choix=1
vchoix=[1,2,3]
def ns():
  sleep(1)
  for xns in range(600):
    fill_rect(xns,0,1,320,color(0,0,0))
    fill_rect(xns+1,0,1,320,color(255,255,255))
    if xns<250:
      draw_string("niveau suivant",xns-140,100,"white","black")
    sleep(0.002)
fill_rect(60,45,200,150,"orange")
def act():
  fill_rect(61,46,198,148,"black")
  for i in range(len(vchoix)):
    if choix==vchoix[i]:
      ca=1
    else:
      ca=0
    draw_string("ESCAPE par Aubin",70,10,color(200,200,255),"black")
    draw_string("Choisis la vitesse",70,50,"white","black")
    draw_string("D'execution",95,70,"white","black")
    draw_string(str(vchoix[i]),120+20*(i+1),120,color(255,255,255),color(ca*200,ca*100,0))
    draw_string("[OK] pour passer",75,150,"white","black")
    draw_string("un niveau",110,170,"white","black")
act()
while True:
  if keydown(KEY_LEFT) and choix>1:
    choix=choix-1
    act()
    while keydown(KEY_LEFT):
      pass
  if keydown(KEY_RIGHT) and choix<3:
    choix=choix+1
    act()
    while keydown(KEY_RIGHT):
      pass
  if keydown(KEY_OK) or keydown(KEY_EXE):
    step=choix
    while keydown(KEY_OK):
      pass
    break
while go==1:
  if pa==0 and len(niveaux)>=level+1:
    if level==0:
      zbx=[200,250,750]
      zby=[600,200,500]
    if level==1:
      zbx=[400,550,400,250]
      zby=[650,300,450,300]
    if level==2:
      zbx=[350,300,300]
      zby=[100,290,350]
    nbe=0
    x=xinit[level]
    y=yinit[level]
    for i in range(len(zbl)):
      if zbl[i]-1==level:
        nbe=nbe+1
    levelf=niveaux[level]
    fill_rect(0,0,320,222,color(bg))
    n=0
    for i in range(len(levelf)):
      if levelf[i]=="n":
        n=n+1
  elif len(niveaux)<level+1:
    break
  zbxa=[]
  zbya=[]
  pa=1
  for i in range(nbe):
    zbxa.append(zbx[i]+x)
    zbya.append(zby[i]+y)
  if keydown(KEY_UP) and coly!=1:
    y=y+step
    mov=mov*3
  if keydown(KEY_DOWN)  and coly!=-1:
    y=y-step
    mov=mov*5
  if keydown(KEY_RIGHT) and colx!=2:
    x=x-step
    mov=mov*7
  if keydown(KEY_LEFT) and colx!=-2:
    x=x+step
    mov=mov*2
  colx=0
  coly=0
  d=0
  if keydown(KEY_TWO) and keydown(KEY_NINE):
    level=level+1
    pa=0
    ns()
  for i in range(n):
    xf=levelf[i*22+1]+levelf[i*22+2]+levelf[i*22+3]
    yf=levelf[i*22+4]+levelf[i*22+5]+levelf[i*22+6]
    wf=levelf[i*22+7]+levelf[i*22+8]+levelf[i*22+9]
    hf=levelf[i*22+10]+levelf[i*22+11]+levelf[i*22+12]
    r=levelf[i*22+13]+levelf[i*22+14]+levelf[i*22+15]
    g=levelf[i*22+16]+levelf[i*22+17]+levelf[i*22+18]
    b=levelf[i*22+19]+levelf[i*22+20]+levelf[i*22+21]            
    for k in range(nbe):
      if x+zbx[k]+l>=x+int(xf)-1.5*step and x+zbx[k]<x+int(xf)+int(wf)+1.5*step and y+zby[k]+l>=y+int(yf)-1.5*step and y+zby[k]<=y+int(yf)+int(hf)+1.5*step:
        if x+zbx[k]+l>=x+int(xf)-1.5*step and x+zbx[k]+l<x+int(xf)+1.5*step:
          zbx[k]=zbx[k]-step/2
        if x+zbx[k]<=x+int(xf)+int(wf)+1.5*step and x+zbx[k]>x+int(xf)+int(wf)-1.5*step:
          zbx[k]=zbx[k]+step/2
        if y+zby[k]+l>=y+int(yf)-1.5*step and y+zby[k]+l<y+int(yf)+1.5*step:
          zby[k]=zby[k]-step/2
        if y+zby[k]<=y+int(yf)+int(hf)+1.5*step and y+zby[k]>y+int(yf)+int(hf)-1.5*step:
          zby[k]=zby[k]+step/2
      if x+zbx[k]+l>=xp and x+zbx[k]<xp+l and y+zby[k]+l>=yp and y+zby[k]<=yp+l:
        pa=0  
    if x+int(xf)+int(wf)>0 and x+int(xf)<320 and y+int(yf)+int(hf)>0 and y+int(yf)<222:
      fill_rect(int(x+int(xf)),int(y+int(yf)),int(wf),int(hf),color(int(r),int(g),int(b)))
      d=d+1
      if xp+l>=x+int(xf)-step and xp<x+int(xf)+int(wf)+step and yp+l>=y+int(yf)-step and yp<=y+int(yf)+int(hf)+step:
        if i==n-1:
          level=level+1
          pa=0
          ns()
        if colx==0:
          if xp+l>=x+int(xf)-step and xp+l<x+int(xf)+step:
            colx=2
          if xp>=x+int(xf)+int(wf)-step and xp<x+int(xf)+int(wf)+step:
            colx=-2
        if coly==0:
          if yp+l>=y+int(yf)-step and yp+l<=y+int(yf)+step:
            coly=-1
          if yp<=y+int(yf)+int(hf)+step and yp>=y+int(yf)+int(hf)-step:
            coly=1
    if mov==7 or mov==21 or mov==35 or mov==14:
      fill_rect(x+int(xf)+int(wf),y+int(yf)-step,step,int(hf)+2*step,color(bg))
    if mov==2 or mov==6 or mov==14 or mov==10:
      fill_rect(x+int(xf)-step,y+int(yf)-step,step,int(hf)+2*step,color(bg))
    if mov==3 or mov==15 or mov==21 or mov==6:
      fill_rect(x+int(xf)-step,y+int(yf)-step,int(wf)+2*step,step,color(bg))
    if mov==5 or mov==15 or mov==35 or mov==10:
      fill_rect(x+int(xf)-step,y+int(yf)+int(hf),int(wf)+2*step,step,color(bg))    
  for i in range(nbe):
    if x+zbx[i]+l>=0 and x+zbx[i]<=320 and y+zby[i]+l>=0 and y+zby[i]<=222:
      if x+zbx[i]<=xp:
        zbx[i]=zbx[i]+step/2
      if x+zbx[i]>=xp:
        zbx[i]=zbx[i]-step/2
      if y+zby[i]<=yp:
        zby[i]=zby[i]+step/2
      if y+zby[i]>=yp:
        zby[i]=zby[i]-step/2                     
      fill_rect(int(x+zbx[i]),int(y+zby[i]),l,l,color(255,0,0))    
      if y+zby[i]>zbya[i]:
        fill_rect(int(x+zbx[i]-3*step),int(y+zby[i]-3*step),int(l+3*step),int(3*step),color(bg))
      if y+zby[i]<zbya[i]:
        fill_rect(int(x+zbx[i]-1.5*step),int(y+zby[i]+l),int(l+3*step),int(3*step),color(bg))
      if x+zbx[i]>zbxa[i]:
        fill_rect(int(x+zbx[i]-3*step),int(y+zby[i]-1.5*step),int(3*step),int(l+3*step),color(bg))
      if x+zbx[i]<zbxa[i]:
        fill_rect(int(x+zbx[i]+l),int(y+zby[i]-1.5*step),int(3*step),int(l+3*step),color(bg))
  if keydown(KEY_OK):
    level=level+1
    pa=0
    ns()
    while keydown(KEY_OK) or keydown(KEY_EXE):
      pass
  fill_rect(xp,yp,l,l,color(0,0,155))
  mov=1
fill_rect(0,0,320,222,color(0,0,0))
draw_string("Fin du jeu",110,100,"white","black")
draw_string("Par Aubin",115,120,"white","black")

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.