chutelastjourneytest.py

Created by rockingchair1196

Created on May 21, 2025

9.45 KB


p='Chute: The Last Journey'
o=float
i=print
a=False
Y=range
U=None
K=True
G=len
F=int
from micropython import *
from kandinsky import fill_rect as E,color as O,draw_string as B
from ion import keydown as L
from time import sleep as R,monotonic as V
kbd_intr(52)
P=(255,)*3
q=100,150,100
r=255,100,0
M=0
S,v,w,W,x=O(255,0,0),O(0,255,0),O(0,0,255),O(200,200,200),O(0,0,0)
j=[[(3,0,17,30,S),(0,3,12,10,W)],[(0,0,20,30,S),(1,1,18,28,P)],[(3,0,17,30,S),(5,6,3,3,W),(12,6,3,3,W),[5,13,10,3,W]],[(3,5,16,25,S),(0,8,11,10,W)],[(3,0,17,26,S),(13,26,7,4,S),(3,26,6,4,S),(0,4,12,5,W)]]
D=0
C=6
X=K
Z='Crash'
b=0
Q=[[360,-40],[0,0]]
class k:
  def __init__(A,x,y,sp,ma=K):A.x=o(x);A.y=o(y);A.sp=sp;A.move_alone=ma;A.chute=0;A.gx=A.x+10;A.gy=A.y+30;A.dead=a;A.drawing=[];A.shooting=U
  def set_drawing_inverse(B):
    B.drawing_inverse=[U]*G(B.drawing)
    for C in Y(G(B.drawing)):A=B.drawing[C];B.drawing_inverse[C]=[20-A[0]-A[2],A[1],A[2],A[3],A[4]]
  def contact(A,x1,y1,x2,y2):
    if A.x<=x1<=A.x+20 or A.x<=x2<=A.x+20:
      if A.y<=y1<=A.y+30 or A.y<=y2<=A.y+30:return K
    return a
  def step(B):
    C=B.x;D=B.y;B.move()
    if B.x!=C or B.y!=D or G(A):E(F(C),F(D),20,30,P);B.draw()
    if H:d((0,)*3)
  def move(A):
    global D,C,Q
    if H:d(P)
    if A.chute:
      if A.chute>0:
        if A.tomber():A.y+=F(A.chute*.4);A.chute+=1
        elif not A.tomber():A.y=T[A.get_plateform()][1]-30
      else:A.y+=F(A.chute);A.chute+=.8
    if A.move_alone:
      A.x+=A.sp
      if A.tomber():A.sp*=-1;A.x+=A.sp
    else:
      B=L(3)-L(0)
      if B:A.sp=abs(A.sp)*B;A.x+=A.sp
      if (L(5) or L(1))and not A.tomber():A.y=T[A.get_plateform()][1]-30;A.chute=-10
      if A.x>320:
        if G(N[C])>D+1:
          if N[C][D+1]!=[]:A.dead=K;D+=1
        else:A.x-=A.sp
      if A.x<0:
        if D>0:
          if N[C][D-1]!=[]:A.dead=K;D-=1
          elif C!=G(N)-4:A.x-=A.sp
        else:A.x-=A.sp
      E=F(A.chute*.4)
      if A.y>222:
        A.dead=K
        if G(N)>C+1:
          if G(N[C+1])>D:
            if N[C+1][D]!=[]:A.dead=K;C+=1
      if A.y<-20 and C>0:
        if G(N[C-1])>D:
          if N[C-1][D]!=[]:A.dead=K;C-=1
    if A.tomber()and A.chute==0:A.chute=1
    if A.dead:Q[0]=[A.x,A.y]
  def tomber(A):
    A.gx=A.x+10;A.gy=A.y+30
    for B in T:
      if A.gy<=B[1]<=A.gy+A.chute:
        if B[0]<=A.gx-8<=B[0]+B[2]or B[0]<=A.gx+7<=B[0]+B[2]or A.gx-8<=B[0]<=A.gx+7:return a
    return K
  def get_plateform(B):
    for A in T:
      if B.gy<=A[1]<=B.gy+B.chute:
        if A[0]<=B.gx-8<=A[0]+A[2]or A[0]<=B.gx+7<=A[0]+A[2]or B.gx-8<=A[0]<=B.gx+7:return T.index(A)
  def draw(B):
    if B.sp<=0:
      for A in B.drawing:E(F(B.x)+A[0],F(B.y)+A[1],A[2],A[3],A[4])
    else:
      for A in B.drawing_inverse:E(F(B.x)+A[0],F(B.y)+A[1],A[2],A[3],A[4])
def s(cl):
  for A in T:E(A[0],A[1],A[2],A[3],cl)
def y():
  for A in J:A.move();A.draw()
H=U
f=1
A=[]
c=[]
for l in Y(20):c+=[[F((15**2-(l-10)**2)**.5),l-10]]
def m(e,shooting):A=shooting;return[F(e.gx),F(e.y)+8+10,c[A][0]*((e.sp>0)*2-1),c[A][1],0]
def d(cl):A=m(I,H);E(A[0]+A[2]*2-5,A[1]+A[3]*2-2,10,10,cl)
N=[[[],[],[],[[],[],['The Ascension (5/6)']]],[[],[[],[]],[[[170,114,1]],[[170,214,6,8],[310,214,20,8],[170,144,6,8],[15,100,6,8],[170,60,6,8]]],[[],[[11,214,2,8],[250,220,3,2],[280,175,5,8],[157,120,6,8],[60,30,200,8]]]],[[],[[],[]],[[[135,160,1]],[[135,190,10,8],[5,140,3,8],[50,100,6,8],[170,60,6,8],[170,0,6,2]]],[[],[[155,214,10,8],[310,170,5,8],[240,110,5,8],[5,140,5,8]]]],[[],[[],[]],[[[170,184,2],[130,184,-2]],[[120,214,80,8],[10,160,5,8],[158,110,5,8],[310,60,30,8]]],[[],[[300,214,10,8],[60,214,5,8],[-10,60,30,8],[155,0,10,2]]],[],[[],[],['The 2nd Summit (3/6)']]],[[],[[],[]],[[],[]],[[],[[130,214,60,8],[10,174,10,8],[70,134,10,8],[240,94,10,8],[300,54,10,8],[300,0,10,2]]],[],[[],[[250,148,80,8],[100,100,10,8],[250,52,10,8]]],[[[50,118,4],[50,118,3],[50,118,2]],[[250,178,80,8],[0,148,60,8]]],[[],[[270,218,10,4],[70,208,10,4],[0,178,10,8]]]],[[[],[],['Dev Room (6/6)']],[],[[],[[120,217,80,5],[260,187,70,8]]],[[[130,117,1],[180,117,-1]],[[-10,187,70,8],[130,147,60,8],[260,107,70,8],[130,47,60,8],[130,0,60,2]]],[[],[[-10,107,58,8],[272,107,58,8]]],[[[240,150,1]],[[-10,107,55,8],[240,180,40,8]]],[[[160,150,-1]],[[100,180,80,8],[310,140,20,8]]],[[],[[-10,140,50,8],[110,105,10,6],[200,70,8,5],[270,40,6,4],[270,0,10,2]]]],[[[],[[-10,212,150,10],[180,212,150,10]]],[[[170,150,1]],[[-10,212,90,10],[160,190,80,10],[300,160,50,10]]],[[[153,120,1]],[[0,160,80,10],[153,150,15,5],[270,140,60,10],[270,78,15,5],[153,50,15,5],[120,0,80,2]]],[[],[[-10,140,70,10],[220,118,20,5],[148,78,20,5],[40,78,20,5],[148,140,20,5]]],[[],[]],[[],[]],[[],[[-10,218,340,4]]],[[],[[-10,218,340,4]]],[[],[[-10,218,340,4]]],[[],[[-10,218,340,4]]],[[],[[-10,218,340,4]]]],[[[],[[0,0,130,222],[190,0,140,222]]],[[[158,110,1]],[[-10,50,90,10],[270,90,60,8],[158,70,24,9],[150,140,40,9],[225,180,10,7],[270,214,60,8]]],[[[150,155,1]],[[80,130,190,8],[-10,90,20,8],[-10,214,70,8],[150,185,50,8],[310,90,20,8]]],[[[150,100,1]],[[-10,90,70,8],[140,130,40,8],[260,170,70,8]]],[[[260,140,1]],[[135,215,50,7],[-10,170,70,8],[260,170,70,8]]],[[],[[-10,170,70,8],[240,202,40,8],[260,70,70,8],[130,130,60,8]]],[[],[[-10,70,70,8],[260,70,70,8],[30,110,20,8],[270,110,20,8],[-10,0,340,2]]],[[],[[-10,70,70,8],[260,216,70,6],[-10,0,340,2]]],[[[158,80,1],[158,130,1],[158,30,1]],[[-10,216,70,6],[158,160,4,6],[158,110,4,6],[158,60,4,6],[-10,0,340,2],[260,70,70,8]]],[[],[[-10,0,340,2],[-10,70,70,8],[155,70,10,3],[155,120,10,3],[260,70,10,4]]],[[[120,40,-3],[220,40,-5]],[[-10,0,340,2],[-10,70,340,8]]],[[],[],['Reaching the Clouds Ending (2/6)']]],[[[],[[0,0,130,222],[190,0,140,222]]],[[[290,10,-1],[150,130,1]],[[260,40,70,8],[130,80,60,8],[-10,120,70,8],[130,160,60,8],[260,190,70,8],[130,220,60,2],[260,0,70,2]]],[[[130,120,.5],[270,90,.5]],[[-10,40,90,8],[130,150,40,8],[270,120,60,8],[0,190,5,8],[-10,0,70,2]]],[[[220,135,1],[80,135,1]],[[-10,120,60,8],[270,120,60,8],[80,165,30,8],[220,165,30,8]]],[[],[[-10,120,60,8],[135,0,50,7],[270,120,60,8],[80,60,30,8],[220,60,30,8]]],[[[150,60,1]],[[-10,120,70,8],[140,90,40,8],[240,50,40,8]]],[[],[]],[[],[]],[[],[]],[[],[]],[[],[]]],[[[[160,155,.5]],[[40,40,300,8],[0,214,30,8],[160,190,15,8],[280,150,50,8]]],[[[155,140,1]],[[-10,40,340,8],[-10,150,50,8],[130,0,60,6],[155,180,10,6],[280,151,50,8]]],[[[40,110,-.5],[300,110,3]],[[-10,40,340,8],[-10,151,70,8],[260,152,70,8]]],[[],[[-10,40,340,8],[90,180,50,8]]],[[[70,150,-1.1]],[[-10,40,340,8],[-10,180,90,8]]],[[],[[-10,40,340,8]]],[[],[[-10,40,340,8],[260,216,40,6]]],[[],[[-10,40,340,8],[40,216,60,6],[180,160,3,6]]],[[],[[-10,40,340,8]]],[[],[[-10,40,340,8],[140,216,40,6],[280,170,20,6]]],[[],[[-10,40,340,8],[80,150,20,6]]],[[],[[-10,40,340,8]]]],[[],[],[],[],[[],[[-1400,214,1750,8]]],[[],[[-20,214,360,8],[20,174,40,8],[237,132,20,8],[260,94,70,8]]],[[],[[-10,94,70,8],[150,55,10,8],[-20,214,360,8],[260,0,40,2]]],[[],[[-20,214,360,8]]],[[],[[-20,214,360,8],[300,80,40,8]]],[[],[[-20,214,360,8],[-10,80,70,8],[140,60,40,8],[140,0,40,2]]],[],[[],[],['Subterranean Ending (1/6)']]],[[[],[]],[[],[]],[[],[]],[[],[]],[[],[]]],[[[],[[-10,40,340,8]]],[[[63,190,1]],[[-10,40,340,8],[300,214,10,8],[60,221,10,1]]],[[[145,135,1]],[[-10,40,340,8],[145,165,30,8],[20,120,20,8]]],[[[1073,184,.5]],[[180,214,5,5],[165,160,20,8],[-10,40,340,8],[20,140,10,8]]],[[],[[120,214,5,8],[-10,40,200,8]]]],[[[],[],['The Left Door Ending (4/6)']]]]
def n(ly,lx):
  global I,J,T,A,z,A0,X,D,C,b,X,Z,M;map=N[ly][lx]
  if Q[0]==Q[1]:
    if b<9:b+=1
    else:D,lx=0,0;C,ly=6,6;F=30;H=150;R(.1)
  else:b=0
  E(0,0,320,222,P);A=[];T=map[1];F=Q[0][0];H=Q[0][1]
  if F>=320:F=10
  elif F<0:F=310
  if H<=-20:H=170
  elif H>=222:H=10
  Q[1]=Q[0]
  if(D,C)==(0,6):B(p,45,50)
  I=k(F,H,7,a);I.drawing=[A for A in j[M]];I.set_drawing_inverse();J=[I]
  for K in map[0]:J+=[k(K[0],K[1],K[2])];J[-1].drawing=[(3,0,17,30,(0,255,0)),(0,3,12,10,(200,200,200))];J[-1].set_drawing_inverse()
  if G(map)==3:Z=map[2][0];X=a
  else:I.draw()
g=V()
e=0
def t():
  global H,A,f,A1,A2,e,g
  for Z in Y(G(J)-1,0,-1):
    for M in Y(G(A)-1,-1,-1):
      if J[Z].contact(A[M][0]-5,A[M][1]-5,A[M][0]+5,A[M][1]+5):E(F(J[Z].x),F(J[Z].y),20,30,P);E(A[M][0]-5,A[M][1]-5,10,10,P);del J[Z];del A[M];break
  if L(4)or H!=U:
    if L(4):
      if H==U:H=1
      d(P);H+=f
      if H==G(c)-1 or H==0:f*=-1
    elif H!=U:A+=[m(I,H)];A[-1][0]+=A[-1][2];A[-1][1]+=A[-1][3];d(P);H=U
  for Z in J:Z.step()
  for Z in A:E(Z[0]-5,Z[1]-5,10,10,P)
  for Z in Y(G(A)-1,-1,-1):
    A[Z][0]+=A[Z][2];A[Z][1]+=A[Z][3];A[Z][3]+=1
    if A[Z][1]>222:del A[Z];continue
    E(A[Z][0]-5,A[Z][1]-5,10,10,r)
  for Z in J[1:]:
    if Z.contact(I.x,I.y,I.x+20,I.y+30):I.dead=K
  s(q);e=V()-g
  if e<.017:R(.017-e)
  B(str(1/(V()-g)),0,0)
  g=V()
  if I.dead:n(C,D)
h=0
def u():
  global h,M
  for A in Y(50):B(p,45,A);R(.0125)
  F=0;B('Made by RockingCha1r',60,70);B("Using Antarctus' work",55,90);B('Skins by Varmule',80,202);G=1
  while not L(4):
    if L(1):F-=1;R(.1)
    if L(2):F+=1;R(.1)
    if F%2==0:B('> Jouer',45,150)
    else:B('Jouer  ',45,150)
    if F%2==1:B('> Quitter',45,170)
    else:B('Quitter  ',45,170)
    if L(3):M=(M+1)%5;R(.1);E(190,155,40,40,O(255,255,255))
    if L(0):M=(M-1)%5;R(.1);E(190,155,40,40,O(255,255,255))
    if G!=M:
      B('<   >',175,160)
      for A in j[M]:E(A[0]+190,A[1]+155,A[2],A[3],A[4]);G=M
  if F%2==0:
    E(45,120,275,120,O(255,255,255));H=K;I=V();h=V();n(C,D)
    while X:t()
  if F%2==1:raise BaseException('Aurevoir !')
u()
i('You finished the '+Z+'!')
i('Your time:')
i(round(V()-h,3),' s')
E(0,0,320,222,O(255,255,255))
B(str('You finished the\n'+' '*F((160-G(Z)*5)/10)+Z),80,0)
B('Chute: Last Journey',70,202)

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.