Improved version of the script by wpere274 (https://my.numworks.com/python/wperez274/geometry_dash_x)
Added level selection, level changes, progress bar. Unoptimised
# ORIGINAL BY: Reddit User/ Programmer, # "Calm_Repeat_7267" from kandinsky import * from ion import * from time import * from random import * from kandinsky import fill_rect as FILL from kandinsky import draw_string as STR from ion import keydown as KEY backcolor=(0,)*3 FILL(0,0,322,222,backcolor) while not KEY(52): FILL(0,10,322,5,"red") FILL(0,50,322,5,"red") FILL(0,185,322,2,"red") STR("Geometry Dash X",80,25,"white",backcolor) STR("Key [Up]/[OK] = Jump",40,65,"white",backcolor) STR("Key [Backspace] = Pause/Resume",10,95,"cyan",backcolor) STR("Key [EXE] (on menu)",75,125,"white",backcolor) STR("=",155,145,"white",backcolor) STR("activate/deactivate progress bar",0,160,"white",backcolor) STR("Key [EXE] = start",75,192,"cyan",backcolor) Map=[ [[[0,6,32,1],[32,5,58,2],[90,4,30,3],[108,3,12,1],[120,6,74,1],[128,3,8,1],[132,2,22,1],[150,1,26,1],[162,5,32,1],[172,2,20,1],[202,5,42,2],[248,4,4, 3],[254,5,4,2],[260,6,16,1]],[[218,5,0],[133,4,1],[42,5,0],[52,5,0],[62,5,0],[73,5,0],[82,5,0], [144,6,0],[146,6,0],[142,2,0],[151,1,0],[164,1,0],[160,6,0],[166,5,0],[153,3,1],[158,2,1],[176,3,1],[220,5,0],[230,5,0],[240,5,0],[268,6,0]],276,(0,130,240),(0,0,70)], [[[0,6,32,1],[28,5,26,1],[42,4,12,1],[62,5,24,1],[82,4,4,1],[94,6,108,1],[94,5,42,1],[94,4,38,1],[118,3,14,1],[138,3,8,1],[142,2,24,1],[162,3,8,1],[174,5,14,1],[206,6,4,1],[216,6,20,1],[240,5,10,1],[254,4,8,1],[266,3,6,1],[32,6,54,1]],[[158,6,0],[159,2,0],[126,3,0],[106,4,0],[104,4,0],[73,5,0],[63,5,0],[50,4,0],[35,5,0],[124,3,0],[149,2,0],[151,2,0],[157,2,0],[150,6,0],[156,6,0],[195,6,0],[224,6,0],[226,6,0],[181,5,0],[244,5,0]],272,(0,250,80),(0,70,70)], [[[0,6,32,1],[172,6,42,1],[110,6,24,1],[66,4,32,1],[56,5,46,2],[52,5,2,2],[32,5,18,2],[120,5,4,1],[120,3,4,1],[140,5,4,2],[148,4,4,3],[154,3,4,4],[160,4,4,3],[166,5,4,2],[220,6,52,1],[248,5,24,1],[258,4,14,1]],[[184,6,0],[169,5,0],[167,5,0],[121,3,0],[123,3,0],[92,4,0],[53,5,0],[41,5,0],[83,4,0],[74,4,0],[186,6,0],[194,6,0],[202,6,0],[204,6,0],[217,6,1],[217,6,0],[249,5,0],[230,6,0],[239,6,0],[259,4,0]],272,(200,0,0),(50,0,0)], [[[0,6,32,1],[48,4,23,1],[35,5,36,1],[32,6,77,1],[104,5,5,1],[79,5,14,1]],[[92,5,0],[80,5,0],[59,4,0],[61,4,0],[36,5,0],[20,6,0],[103,6,0]],109,(0,190,190),(0,30,30)] ] sleep(0.5) FILL(0,0,320,222,backcolor) def player(e): global wPlayer,hPlayer FILL(xPlayer,yPlayer,wPlayer,hPlayer,e) def pic(a,b,c): for i in range(5): FILL(xMap+a*10-10+i*2,b*32-i*4+(2*i*4*c)-4*(1-c),20-i*4,4,colorSol) FILL(xMap+a*10+10-i*2,b*32-i*4+(2*i*4*c)-4*(1-c),6,4,backcolor) def sol(x,y,longueur,hauteur): FILL(xMap+x*10,y*32,10*longueur,hauteur*32,colorSol) if longueur<0:FILL(xMap+x*10,y*32,6,hauteur*32,backcolor) else:FILL(xMap+x*10+longueur*10,y*32,6,hauteur*32,backcolor) def arrivee(k): FILL(xMap+k*10,0,10,222,(0,255,0)) FILL(xMap+k*10+10,0,6,222,backcolor) def mapp(): for i in range(len(Map[quelNiveau][0])): if xMap+Map[quelNiveau][0][i][0]*10<320 and xMap+Map[quelNiveau][0][i][0]*10+Map[quelNiveau][0][i][2]*10>-10:sol(Map[quelNiveau][0][i][0],Map[quelNiveau][0][i][1],Map[quelNiveau][0][i][2],Map[quelNiveau][0][i][3]) for j in range(len(Map[quelNiveau][1])): if -10<xMap+Map[quelNiveau][1][j][0]*10+20<340:pic(Map[quelNiveau][1][j][0],Map[quelNiveau][1][j][1],Map[quelNiveau][1][j][2]) arrivee(Map[quelNiveau][2]) def hitBox(): for i in range(len(Map[quelNiveau][0])): if xPlayer+20<Map[quelNiveau][0][i][0]*10+xMap or xPlayer>Map[quelNiveau][0][i][0]*10+Map[quelNiveau][0][i][2]*10+xMap or yPlayer<Map[quelNiveau][0][i][1]*32 or yPlayer>Map[quelNiveau][0][i][1]*32+Map[quelNiveau][0][i][3]*32: b=False else: b=True break if b==False: for i in range(len(Map[quelNiveau][1])): if xPlayer+20<Map[quelNiveau][1][i][0]*10+xMap or xPlayer>Map[quelNiveau][1][i][0]*10+15+xMap or yPlayer>Map[quelNiveau][1][i][1]*32+Map[quelNiveau][1][i][2]*32 or yPlayer<Map[quelNiveau][1][i][1]*32-(1-Map[quelNiveau][1][i][2])*32:b=False else: b=True break return b def percentBar(posX,posY,width,height,backCol,timeTaken): percentage=0 if quelNiveau==0:percentage=timeTaken/levelTimes[0] elif quelNiveau==1:percentage=timeTaken/levelTimes[1] elif quelNiveau==2:percentage=timeTaken/levelTimes[2] elif quelNiveau==3:percentage=timeTaken/levelTimes[3] FILL(posX,posY,width-40,height,(0,)*3) FILL(posX+3,posY+3,width-46,height-6,(0,)*3) FILL(posX+3,posY+3,int((width-46)*percentage),height-6,"green") STR(str(int(percentage*100))+"%",posX+width-25-len(str(int(percentage*100)))*5,posY+int((height-15)/2),backCol,(0,)*3) def drawLevelDisplay(): col=levelCols[quelNiveau] bg=levelBackCols[quelNiveau] text=levelNames[quelNiveau] FILL(70,50,180,112,bg) for i in range(6):FILL(50-i*6,93+i*3,6,36-i*6,(200,200,200)) for i in range(6):FILL(265+i*6,93+i*3,6,36-i*6,(200,200,200)) STR(text[0],180-len(text[0])*5,55,col,bg) STR(text[1],180-len(text[1])*5,75,col,bg) FILL(75,55,30,30,col) FILL(80,60,8,8,(0,)*3) FILL(92,60,8,8,(0,)*3) FILL(80,72,20,8,(0,)*3) percentBar(75,107,170,20,levelBackCols[quelNiveau],levelBests[quelNiveau][0]) STR(str(levelBests[quelNiveau][1])+" attempts",110,132) for i in range(maxLevelAvailable+1):FILL(150-maxLevelAvailable*14+i*28,192,20,20,(200-(i==quelNiveau)*75,200-(i==quelNiveau)*75,200-(i==quelNiveau)*75)) STR("Progress bar:"+barMode,95-len(barMode)*5,25,(20+180*(barMode!="on"),20+180*(barMode=="on"),0),backcolor) def levelSelect(): global quelNiveau,barMode start=False drawLevelDisplay() while not start: if KEY(4):start=True if KEY(0) and maxLevelAvailable>0: if quelNiveau!=0:quelNiveau-=1 else:quelNiveau=maxLevelAvailable drawLevelDisplay() while KEY(0):pass if KEY(3): if quelNiveau<maxLevelAvailable:quelNiveau+=1 else:quelNiveau=0 drawLevelDisplay() while KEY(3):pass if KEY(52): if barMode=="on":barMode="off" else:barMode="on" STR(" ",80,25,backcolor,backcolor) drawLevelDisplay() while KEY(52):pass nbOfLevels=4 quelNiveau=0 while 1: try: xyz=abs(abs(int(input("Number of levels unlocked ?\n(max "+str(nbOfLevels)+")\n"))%5)-1) break except:pass maxLevelAvailable=xyz del xyz while KEY(4):pass levelCols=[(0,120,250),(0,250,120),(250,0,120),(250,0,250)] levelBackCols=[(0,50,100),(0,100,50),(120,0,60),(120,0,120)] levelNames=[["First Steps",""],["School",""],["Intensive","Training"],["War","Machine"]] levelBests=[[0,0],[0,0],[0,0],[0,0]] levelTimes=[15.978,15.745,15.678,6] nowTime=0 barMode="off" #main loop while 1: game=True backcolor=(randint(210,255),randint(210,255),randint(210,255)) playercolor=(randint(0,155),randint(0,155),randint(0,155)) colorSol=(randint(0,55),randint(0,55),randint(0,55)) b=False gravity=False xPlayer=50 yPlayer=50 Vjump=38 wPlayer=20 hPlayer=20 SautAutorise=True xMap=0 fini=False jump=False enLAir=0 FILL(0,0,320,222,backcolor) for i in range(6):FILL(50-i*6,93+i*3,6,36-i*6,(200,200,200)) for i in range(6):FILL(265+i*6,93+i*3,6,36-i*6,(200,200,200)) STR("Geometry Dash X",85,0) levelSelect() FILL(0,0,320,222,backcolor) cEstParti=0 attempts=-2 while KEY(4):pass while game: if xMap%18==0: STR("Time:"+str(round(nowTime,3)),0,0,"cyan","black") FILL(100+10*(nowTime>9.99),0,130-10*(nowTime>9.99)-len(str(attempts))*10,20,backcolor) if barMode=="on":percentBar(100+10*(nowTime>9.99),0,140-10*(nowTime>9.99)-len(str(attempts))*10,20,backcolor,nowTime) if xMap%36==0:STR("Attempt:"+str(attempts),240-len(str(attempts))*10,0,"green","black") if cEstParti==0: STR("Press [OK] to start",65,50) STR("Press [EXE] to Randomize",40,110) STR("the Theme!",110,130) if KEY(52): sleep(0.2) backcolor=(randint(0,255),randint(0,255),randint(0,255)) colorSol=(randint(0,255),randint(0,255),randint(0,255)) FILL(0,0,320,222,backcolor) mapp() player(playercolor) if KEY(4): FILL(0,0,322,222,backcolor) cEstParti=True if cEstParti==True: if xMap==0: time=monotonic() attempts+=1 if jump==False and fini==False: for i in range(len(Map[quelNiveau][0])): if yPlayer+20==Map[quelNiveau][0][i][1]*32 and Map[quelNiveau][0][i][0]*10+xMap-19<=50<=Map[quelNiveau][0][i][2]*10+Map[quelNiveau][0][i][0]*10+xMap: SautAutorise=True gravity=False break else: SautAutorise=False gravity=True if gravity==True: player(backcolor) yPlayer+=16 player(playercolor) if KEY(4) and SautAutorise==True or KEY(KEY_UP) and SautAutorise==True: player(backcolor) jump=True yPlayer-=int(Vjump) Vjump=Vjump/2 player(playercolor) if jump==True and fini==False and SautAutorise==True: player(backcolor) for k in range(len(Map[quelNiveau][0])): if yPlayer+20!=Map[quelNiveau][0][k][1]*32: jump=True elif Map[quelNiveau][0][k][0]*10+xMap-19<50<Map[quelNiveau][0][k][0]*10+xMap+Map[quelNiveau][0][k][2]*10+20: jump=False break if jump==True: yPlayer-=int(Vjump) if Vjump>2:Vjump=Vjump/2 elif Vjump==2:Vjump=0 elif Vjump==0: enLAir+=1 if enLAir==4: enLAir=0 Vjump=-2 elif Vjump<=(-2) and Vjump>(-32):Vjump=Vjump*2 else: jump=False Vjump=32 SautAutorise=True else: jump=False Vjump=32 SautAutorise=True player(playercolor) if fini==False: xMap-=6 mapp() # level completed else: STR("MISSION COMPLETE!!",100,50,colorSol,backcolor) STR("Press [OK] key",110,150,colorSol,backcolor) game=False levelBests[quelNiveau][0]=levelTimes[quelNiveau] levelBests[quelNiveau][1]+=attempts if quelNiveau==maxLevelAvailable: if maxLevelAvailable+1<nbOfLevels: maxLevelAvailable+=1 STR("New level unlocked",100,100,(200,20,0),backcolor) quelNiveau+=1 while not KEY(4):pass while KEY(4):pass # player crashes if yPlayer+hPlayer>222 or hitBox(): FILL(0,0,320,222,backcolor) xMap=0 yPlayer=172 if levelBests[quelNiveau][0]<nowTime:levelBests[quelNiveau][0]=nowTime sleep(0.03) if xPlayer+wPlayer>Map[quelNiveau][2]*10+xMap:fini=True nowTime=round(monotonic()-time,3) if KEY(17): oldTime=monotonic() STR("(PAUSED)",110,60,"black",backcolor) STR("Press [Backspace] to Resume",15,100,"blue",backcolor) STR("Press [EXE] to exit level",35,140,"blue",backcolor) while KEY(17):pass while not (KEY(17) or KEY(52)):pass if KEY(52): game=False if levelBests[quelNiveau][0]<nowTime:levelBests[quelNiveau][0]=nowTime if attempts>0:levelBests[quelNiveau][1]+=attempts while KEY(17) or KEY(52): STR(" ",110,60,backcolor,backcolor) STR(" ",15,100,backcolor,backcolor) STR(" ",35,140,backcolor,backcolor) time+=monotonic()-oldTime