guide="""
Basic Guide:
====================================
Keys:
------------------------------------------
Key [ Backspace ] = Set shape or object.
Key [ VAR ] = Undo Last object.
Key [ COSINE ] = Test Game Level.
Key [ EXE ] = EXIT & Print Data of All Set Objects
and Background as well..
================================
FAST MODE:
Hold [ SHIFT ] to SHAPE Change fast.
-----------------------------------------------------
SHAPE Change ***********************
( - Decrease Width ) [ ( ], [ ) ] ( Increase Width+ )
( - Decrease Height ) [ * ], [ / ] ( Increase Height + )
*********************************************************
Hold [ Sq ] to go fast with Movement ( LEFT RIGHT UP DOWN ).
**Colors:
[ OK ] = Drop Last Set Piece.
[ 0 ] (ZERO) = RANDOMIZE All Colored Objects and Background.
[ 1 ] = Change All Set Objects Color to Black.
[ 7 ] = Red
[ 8 ] = Green
[ . ] = Change Current Unset Object to Color Black & Background to White.
[ x10^ ] = Opposite of [ . ]
Every Key has a different fucntion.
##################################
"""#LEVEL & SPRITE CREATOR
#BY: WILSON
frommathimport*fromrandomimport*fromrandomimportrandintasRANDfromkandinskyimport*fromkandinskyimportfill_rectasFfromionimportkeydownasKEYPfromkandinskyimportdraw_stringasSTRfromionimport*fromtimeimport*M=255MAPX=0MAPY=0sketch_mode=FalseTEST_ON=Falsebg=(M,)*3pixels_captured=0SW=322SH=222faston=TrueBLACK=(0,)*3WHITE=(M,)*3GRAY=(180,)*3RED=(M,0,0)GREEN=(0,M,0)BLUE=(0,0,M)CYAN=(0,M,M)YELLOW=(M,M,100)MAGENTA=(M,0,M)GRAY=(155,)*3RED=(155,0,0)GREEN=(0,155,0)BLUE=(0,0,155)penup=Falsependown=Truepx=40py=100pc=(0,0,255)pw=50ph=10ALLSCREENPIXELS=[]###########################
#
# TO EDIT A LEVEL,
#
# PASTE DATA BELOW HERE!!
#
############################
# level to edit
edited_bg=(242,187,75)edited_level=[[MAPX+28,MAPY+105,294,117,(49,14,65)],[MAPX+199,MAPY+52,123,7,(82,92,26)],[82,79,79,7,(62,208,36)],[MAPX+145,MAPY+148,22,42,(0,M,M)],[224,148,24,42,(46,230,247)],[MAPX+75,MAPY+144,27,43,(224,90,148)],[207,59,115,44,(35,6,95)],[MAPX+1,MAPY+46,50,20,(0,0,0)],[97,40,50,20,(0,0,0,)]]edited_level_on=Falsen=[px,py,pw,ph,pc]edited_n=[]grillon=FalseTESTMODE=FalsedefTEST():globalALLSCREENPIXELS,refresh_level,bg,px,py,pw,ph,pcGAME_OVER=Falsefloat_energy=30score=0life=3x=100y=30w=RAND(13,16)h=RAND(12,24)c=(RAND(0,255),RAND(0,255),RAND(0,255))direc=["left","right","up","down"]DIR=direc[0]foriinALLSCREENPIXELS:ifi[2]<20andi[3]<20:F(i[0],i[1],i[2],i[3],i[4])ifDIR==direc[0]:i[0]-=1F(i[0]+i[2]+1,i[1],1,i[3],bg)ifDIR==direc[1]:i[0]-=1F(i[0]-1,i[1],1,i[3],bg)ifi[0]<0:i[0]=0ifi[0]+i[2]>322:i[0]=322-i[2]ifx+w>=i[0]andx<=i[0]+i[2]andy+h>=i[1]andy<=i[1]+i[3]:sleep(0.3)F(x,y,w,h,b,g)x=150y=30life-=1F(0,0,322,222,bg)foriinALLSCREENPIXELS:F(*i)whilenotGAME_OVERandnotkeydown(KEY_OK):draw_string("E:[",2,1)fill_rect(30,4,int(float_energy),13,(0,255,255))fill_rect(x,y,w,h,c)fill_rect(x+3,y+3,4,3,BLACK)fill_rect(x+9,y+3,4,3,BLACK)ifkeydown(KEY_LEFT):x-=1fill_rect(x+w+1,y,1,h,bg)ifkeydown(KEY_RIGHT):x+=1fill_rect(x-1,y,1,h,bg)ifkeydown(KEY_UP)andfloat_energy>0orkeydown(KEY_BACKSPACE)andfloat_energy>0:y-=2fill_rect(230,4,int(float_energy),13,bg)float_energy-=0.4fill_rect(x,y+h+1,w,1,bg)foriinALLSCREENPIXELS:ifx+w>i[0]andx<i[0]+i[2]andy+h>i[1]andy+h<i[1]+2andi[-1]==(255,0,0):sleep(0.2)life-=1x=100y=30float_energy=40foriinALLSCREENPIXELS:ifx+w>i[0]andx<i[0]+i[2]andy+h>i[1]andy+h<i[1]+2:float_energy=0y-=1float_energy=40foriinALLSCREENPIXELS:ifx+w>i[0]andx<i[0]+i[2]andy+h>i[1]andy+h<i[1]+i[3]:foriinALLSCREENPIXELS:F(*i)iflife<1:sleep(0.4)fill_rect(0,0,322,222,(0,0,0))sleep(1)draw_string("GAME OVER",100,80,(255,0,0),(0,0,0))sleep(1)draw_string("Score:"+str(score),100,130,WHITE,(0,0,0))sleep(1.5)draw_string("PRESS [OK]",120,180,BLACK,GREEN)GAME_OVER=Truepx=100py=100pw=20ph=6refresh_level()TEST_ON=Falseifget_pixel(x,y+h)!=(0,0,0)andget_pixel(x+w,y+h)!=(0,0,0)orget_pixel(x,y+h)!=(255,)*3andget_pixel(x+w,y+h)!=(255,)*3:sleep(0.001)y+=1fill_rect(x-1,y-1,w+2,1,bg)ifget_pixel(x,y+h)==(0,0,0)andget_pixel(x+w,y+h)==(0,0,0):float_energy=30ify+h>222:float_energy=30y=222-hdefdraw_grill():globalpw,ph,SW,SHsize=pwforiinrange(320//10):fill_rect(10*i,0,1,10*(220//10),BLACK)ifsize*i<=220:fill_rect(0,10*i,320,1,(RAND(0,150),RAND(0,150),RAND(0,150)))defprint_data():globalpw,ph,pixels_capturedSTR("W:"+str(pw)+",H:"+str(ph),40,1,BLACK,bg)STR("[P]:"+str(len(ALLSCREENPIXELS)),140,1,CYAN,BLACK)F(60,20,SW,2,BLACK)#********************
#///important!/////
#dont remove
#///////////////////
defdraw_edited_level():globaledited_level,edited_bg,SW,SHforiinedited_level:fill_rect(*i)defrefresh_level():globalALLSCREENPIXELS,bg,SW,SH,TESTifTEST_ON==False:F(0,0,SW,SH,bg)foriinALLSCREENPIXELS:fill_rect(*i)DROP=Falsedefdrop_piece():globalpx,py,pw,ph,pc,n,ALLSCREENPIXELSALLSCREENPIXELS[-1][1]+=4F(ALLSCREENPIXELS[-1][0],ALLSCREENPIXELS[-1][1]-4,ALLSCREENPIXELS[-1][2],4,bg)sleep(0.5)cursx=150cursy=0#main function
EXIT=FalsewhilenotKEYP(KEY_EXE)andnotEXIT:ifKEYP(KEY_LOG):print_data()F(px,py,pw,ph,pc)#**************************
# navigate
#**************************
ifKEYP(KEY_LEFT):px-=3ifKEYP(KEY_RIGHT):px+=3ifKEYP(KEY_UP):py-=3ifKEYP(KEY_DOWN):py+=3#**************************
ifKEYP(KEY_BACKSPACE):sleep(0.2)ALLSCREENPIXELS.append(n)STR("[P]:"+str(len(ALLSCREENPIXELS)),200,1,CYAN,BLACK)ifnotKEYP(KEY_LEFT):ifnotKEYP(KEY_RIGHT):ifnotKEYP(KEY_UP):ifnotKEYP(KEY_DOWN):pc=GRAYpw-=3ph-=3F(px,py,pw,ph,pc)#****[ pen : up,down,erase
#dont remove this
n=[px,py,pw,ph,pc]# colors
ifKEYP(KEY_EE):sleep(0.2)bg=BLACKiflen(ALLSCREENPIXELS)>0:foriinALLSCREENPIXELS:i[-1]=WHITErefresh_level()#***********************
ifKEYP(KEY_ONE):sleep(0.2)iflen(ALLSCREENPIXELS)>0:foriinALLSCREENPIXELS:i[-1]=BLACKrefresh_level()ifKEYP(KEY_TWO):sleep(0.2)pc=WHITEF(px,py,pw,ph,pc)ifKEYP(KEY_THREE):sleep(0.2)pc=(RAND(0,M),RAND(0,M),M)F(px,py,pw,ph,pc)ifKEYP(KEY_FOUR):sleep(0.2)foriinALLSCREENPIXELS:i[-1]=WHITErefresh_level()ifKEYP(KEY_SIX):sleep(0.2)TEST()ifKEYP(KEY_SEVEN):sleep(0.2)pc=(255,0,0)ifKEYP(KEY_EIGHT):sleep(0.2)pc=(0,255,0)F(px,py,pw,ph,pc)#/////////////////////////
#grill on
ifKEYP(KEY_NINE):sleep(0.2)draw_grill()sketch_mode=Trueifkeydown(KEY_PI):sketch_mode=Falsebg=WHITEpc=BLACKrefresh_level()ifKEYP(KEY_ANS):sleep(0.2)cursx=20cursy=120F(0,0,SW,SH,BLACK)whilenotKEYP(KEY_OK):STR("Press [OK] ",20,0)iflen(ALLSCREENPIXELS)>=0:STR(str(ALLSCREENPIXELS),cursx,cursy,GREEN,BLACK)ifKEYP(KEY_LEFT):F(200,1,122,20,WHITE)iflen(ALLSCREENPIXELS)<10:cursx-=2iflen(ALLSCREENPIXELS)>=10:cursx-=5ifKEYP(KEY_RIGHT):F(200,1,122,20,WHITE)iflen(ALLSCREENPIXELS)<10:cursx+=2iflen(ALLSCREENPIXELS)>=10:cursx+=5ifcursx>310:cursx=310ifcursx<-len(ALLSCREENPIXELS)*322:cursx=-len(ALLSCREENPIXELS)*322STR("X,Y: "+str(cursx)+","+str(cursy),200,1,CYAN,BLACK)refresh_level()F(px,py,pw,ph,pc)ifKEYP(KEY_LEFTPARENTHESIS):pw-=2F(px,py,pw,ph,pc)ifkeydown(KEY_SHIFT):pw-=6ifsketch_mode==False:refresh_level()ifKEYP(KEY_RIGHTPARENTHESIS):pw+=2F(px,py,pw,ph,pc)ifkeydown(KEY_SHIFT):pw+=6ifsketch_mode==False:refresh_level()ifKEYP(KEY_MULTIPLICATION):ph-=2F(px,py,pw,ph,pc)ifkeydown(KEY_SHIFT):ph-=6ifsketch_mode==False:refresh_level()ifKEYP(KEY_DIVISION):ph+=2ifkeydown(KEY_SHIFT):ph+=6ifsketch_mode==False:refresh_level()ifKEYP(KEY_PLUS):pw-=2ph-=2F(px,py,pw,ph,pc)ifkeydown(KEY_SHIFT):pw-=6ph-=6ifsketch_mode==False:refresh_level()ifKEYP(KEY_MINUS):F(px,py,pw,ph,pc)pw+=2ph+=2ifkeydown(KEY_SHIFT):pw+=6ph+=6ifsketch_mode==False:refresh_level()ifpw<2:pw=2ifph<2:ph=2ifKEYP(KEY_OK):sleep(0.2)pc=(RAND(0,255),RAND(0,255),RAND(0,255))F(px,py,pw,ph,pc)ifpixels_captured<0:pixels_captured=0ifKEYP(KEY_OK):pc=(RAND(0,M),RAND(0,M),RAND(0,M))refresh_level()ifKEYP(KEY_DOT):bg=WHITEforiinALLSCREENPIXELS:i[-1]=BLACKrefresh_level()ifKEYP(KEY_LEFT)orKEYP(KEY_RIGHT)orKEYP(KEY_UP)orKEYP(KEY_DOWN):ifgrillon==False:refresh_level()ifKEYP(KEY_ZERO):sleep(0.2)bg=(RAND(0,M),RAND(0,M),RAND(0,M))refresh_level()ifKEYP(KEY_EXP):sleep(0.2)edited_level_on=Truedraw_edited_level()ifKEYP(KEY_SINE):sleep(0.2)STR("EDIT MODE",200,1,WHITE,WHITE)edited_level_on=Falserefresh_level()ifedited_level_on:STR("EDIT MODE",200,1)ifpy<0:py=0ifpy>300:py=190ifpx<0:px=0ifpx+pw>322:px=322-pwifpy<0:py=0ifpy+ph>222:py=222-phifKEYP(KEY_LEFT):ifkeydown(KEY_SQUARE):px-=8ifsketch_mode==False:refresh_level()ifKEYP(KEY_RIGHT):ifkeydown(KEY_SQUARE):px+=8ifsketch_mode==False:refresh_level()ifKEYP(KEY_UP):ifkeydown(KEY_SQUARE):py-=8ifsketch_mode==False:refresh_level()ifKEYP(KEY_DOWN):ifkeydown(KEY_SQUARE):py+=8ifsketch_mode==False:refresh_level()#important
# pop last piece
ifKEYP(KEY_VAR):iflen(ALLSCREENPIXELS)>0:sleep(0.2)delALLSCREENPIXELS[-1]refresh_level()ifKEYP(KEY_LOG):TESTMODE==TrueifTESTMODE:TEST()ifKEYP(KEY_TANGENT)orKEYP(KEY_BACKSPACE):STR("[P]:"+str(len(ALLSCREENPIXELS)),200,1,CYAN,BLACK)ifKEYP(KEY_LEFTPARENTHESIS):F(px+pw-1,py,1,ph,CYAN)F(px+pw+1,py,2,ph,bg)ifKEYP(KEY_MULTIPLICATION):F(px,py+ph-1,pw,1,CYAN)F(px,py+ph+1,pw,2,bg)ifKEYP(KEY_PLUS):F(px,py+ph-1,pw,1,CYAN)F(px,py+ph+1,pw,2,bg)F(px+pw-1,py,1,ph,CYAN)F(px+pw+1,py,2,ph,bg)ifKEYP(KEY_POWER):sleep(0.2)px=150py=100pw=3ph=3bg=BLACKpc=WHITEifKEYP(KEY_VAR):iflen(ALLSCREENPIXELS)==0:pw=10ph=10refresh_level()sleep(0.1)ifKEYP(KEY_TOOLBOX):sleep(0.2)fill_rect(200,100,100,100,bg)pw+=pwph+=phifpw>SW:pw=SWifph>SH:ph=SHgetkey=KEYPifgetkey(KEY_COSINE):sleep(0.2)TEST()ifpc==bg:pc=choice(['red','blue','green','yellow','white','gray'])# DROP=True
iflen(ALLSCREENPIXELS)>0:ifDROP:drop_piece()iflen(ALLSCREENPIXELS)>0:ifALLSCREENPIXELS[-1][1]+ALLSCREENPIXELS[-1][3]>222:ALLSCREENPIXELS[-1][1]=222-ALLSCREENPIXELS[-1][3]DROP=FalseifKEYP(KEY_OK):sleep(0.2)DROP+=1ifDROP>1:DROP=0#///END//////
sleep(1)STR("press [OK]",100,100)print("\n")name=input("name: ")print("bg = ",bg)iflen(name)<1:print(ALLSCREENPIXELS)
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
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.