"""
Quickly Create Levels, Sprites, etc.
without the hassle of the mathematics.
To be used with any of my scripts with the words "level_view" or" viewer".
After EXE,
After printer,
Just Copy and paste, using [Up] Arrow, [Shift], Copy....and eventually Paste.
You Welcome :-)
-------------------------------
Contact:
wperez274@gmail.com
-------------------------------
Sincerely,
Wilson
""""""
----------------------------------------------------------
Basic Guide
=====================================
LEFT, RIGHT, UP, DOWN Arrows = Move, ( NAVIGATION )
=========================================
FAST MOVE (Hold [Square] ....right above the parenthesis [ ) ] key
*[Arrows] + shift = Fast Move
===========================================
#Important
#############################################
* [Backspace] = Set Shape
* [EXE] = Exit & Print Data ( 0f Level, Sprite, etc. )
* [VAR],[SQRT] = pop last piece. (UNDO LAST).
#############################################
--------------------------------------------------------------------------
[(] ) , [)] = - ( width ), (width) +
[x] ) , [/] = - ( height ), (height) +
[+] ) , [-] = -( width )+, (width)+ ( Increase width & height )
==========================================================
Fast Size Increase, Decrease: ( Hold [Shift] ) .....Near [Down] [Arrow]
==========================================================
[Shift] + [(] ) , [)] = - ( width ), (width) +
[x] ) , [/] = - ( height ), (height) +
[+] ) , [-] = -( width )+, (width)+ ( Increase width & height )
---------------------------------------------------------------------
[OK] = Random Paint "Brush"
[ZERO] = Random All Colors ( Theme Generator )
------------------------------------------------------------------
[ 1 ]-[ 3 ] = Random red, green, blue
[ . ] = Paint Background White , Color Brush = Black
[ x10^ ] = Paint Background Black , Color Brush = White
---------------------------------------------------------------------------
# still working on improving this one..
[9] = "SKETCH MODE"
[Pi] = Clear
--------------------------
"""#LEVEL & SPRITE CREATOR
#BY: WILSON
frommathimport*fromrandomimport*fromrandomimportrandintasRANDfromkandinskyimport*fromkandinskyimportfill_rectasFfromionimportkeydownasKEYPfromkandinskyimportdraw_stringasSTRfromionimport*fromtimeimport*M=255MAPX=0MAPY=0sketch_mode=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=50py=100pc=(0,0,0)pw=10ph=10sprite=[]###########################
#
# 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=False#
#
##########################
n=[px,py,pw,ph,pc]edited_n=[]grillon=Falsedefdraw_grill():globalpw,ph,SW,SHforiinrange(0,SW,pw):forjinrange(0,SH,ph):F(i,0,1,SH,BLACK)F(0,0,1,SH,BLACK)defprint_data():globalpw,ph,pixels_capturedSTR("W:"+str(pw),1,0,BLACK,GREEN)STR("H:"+str(ph),50,0,BLACK,YELLOW)STR("PIXELS:"+str(len(sprite)),110,0,BLACK,GRAY)F(0,20,SW,2,BLACK)#********************
#///important!/////
#dont remove
#///////////////////
defdraw_edited_level():globaledited_level,edited_bg,SW,SHforiinedited_level:fill_rect(*i)defrefresh_level():globalsprite,bg,SW,SHF(0,22,SW,SH,bg)foriinsprite:fill_rect(*i)sleep(0.5)cursx=150cursy=0#main function
whilenotKEYP(KEY_EXE):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)sprite.append(n)#****[ pen : up,down,erase
#dont remove this
n=[px,py,pw,ph,pc]# colors
ifKEYP(KEY_EE):sleep(0.2)pc=WHITEbg=BLACKrefresh_level()#***********************
#***********************
ifKEYP(KEY_ONE):sleep(0.2)pc=(M,RAND(0,M),RAND(0,M))F(px,py,pw,ph,pc)ifKEYP(KEY_TWO):sleep(0.2)pc=(RAND(0,M),M,RAND(0,M))F(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)pc=(M,M,RAND(0,M))F(px,py,pw,ph,pc)ifKEYP(KEY_FIVE):sleep(0.2)pc=(M,RAND(0,M),M)F(px,py,pw,ph,pc)ifKEYP(KEY_SIX):sleep(0.2)pc=(RAND(0,M),M,M)F(px,py,pw,ph,pc)ifKEYP(KEY_SEVEN):sleep(0.2)pc=choice([(RAND(0,100),RAND(0,100),RAND(0,100))])ifKEYP(KEY_EIGHT):sleep(0.2)pc=CYANF(px,py,pw,ph,pc)#/////////////////////////
#grill on
ifKEYP(KEY_NINE):sleep(0.2)draw_grill()refresh_level()draw_grill()F(px,py,pw,ph,pc)bg=WHITEpc=BLACKrefresh_level()sketch_mode=Trueifsketch_mode:STR("sketch_mode",1,200,BLACK,CYAN)ifkeydown(KEY_PI):sketch_mode=Falserefresh_level()ifKEYP(KEY_ANS):sleep(0.2)cursx=20cursy=120F(0,0,SW,SH,BLACK)whilenotKEYP(KEY_OK):STR("Press [OK] ",20,0)iflen(sprite)>=0:STR(str(sprite),cursx,cursy,GREEN,BLACK)ifKEYP(KEY_LEFT):F(200,1,122,20,BLACK)iflen(sprite)<10:cursx-=2iflen(sprite)>=10:cursx-=5ifKEYP(KEY_RIGHT):F(200,1,122,20,BLACK)iflen(sprite)<10:cursx+=2iflen(sprite)>=10:cursx+=5ifcursx>310:cursx=310ifcursx<-len(sprite)*322:cursx=-len(sprite)*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=2print_data()ifKEYP(KEY_OK):sleep(0.2)pc=(RAND(0,M),RAND(0,M),RAND(0,M))pendown=TrueF(px,py,pw,ph,pc)ifpixels_captured<0:pixels_captured=0ifKEYP(KEY_OK):pc=(RAND(0,M),RAND(0,M),RAND(0,M))ifKEYP(KEY_DOT):bg=WHITEpc=BLACKrefresh_level()ifKEYP(KEY_LEFT)orKEYP(KEY_RIGHT)orKEYP(KEY_UP)orKEYP(KEY_DOWN):ifgrillon==False:refresh_level()ifKEYP(KEY_ZERO):sleep(0.2)iflen(sprite)>0:foriinsprite:i[-1]=(RAND(0,M),RAND(0,M),RAND(0,M))bg=(RAND(0,M),RAND(0,M),RAND(0,M))pc=(RAND(0,M),RAND(0,M),RAND(0,M))refresh_level()ifKEYP(KEY_NINE):sleep(0.2)bg=WHITEpc=BLACKrefresh_level()pendown=Truegrillon=TrueF(280,2,15,15,pc)ifKEYP(KEY_EXP):sleep(0.2)edited_level_on=Truedraw_edited_level()ifKEYP(KEY_SINE):sleep(0.2)STR("EDIT MODE",190,1,WHITE,WHITE)edited_level_on=Falserefresh_level()ifedited_level_on:STR("EDIT MODE",190,1,BLACK,CYAN)draw_edited_level()ifkeydown(KEY_LEFT):ifpx<-50:px=50MAPX+=2sprite[0][0]+=2sprite[1][0]+=2ifkeydown(KEY_RIGHT):ifpx>350:px=270MAPX-=2foriinsprite:sprite[i][0]-=2py-=2ifpy<-50:py=20sprite[0][1]+=2sprite[1][1]+=2ifpy>300:py=190sprite[0][1]-=2sprite[1][1]-=2STR(str(px)+","+str(py),200,1,BLACK,CYAN)ifpx<0:px=0ifpx+pw>322:px=322-pwifpy<20:py=20ifpy+ph>222:py=222-phifKEYP(KEY_LEFT):F(200,2,70,18,WHITE)ifkeydown(KEY_SQUARE):px-=8refresh_level()ifKEYP(KEY_RIGHT):F(200,2,70,18,WHITE)ifkeydown(KEY_SQUARE):px+=8refresh_level()ifKEYP(KEY_UP):F(200,2,70,18,WHITE)ifkeydown(KEY_SQUARE):py-=8refresh_level()ifKEYP(KEY_DOWN):F(200,2,70,18,WHITE)ifkeydown(KEY_SQUARE):py+=8refresh_level()#important
# pop last piece
ifKEYP(KEY_VAR):iflen(sprite)>0:sleep(0.2)delsprite[-1]refresh_level()#///END//////
STR("press [OK]",100,100)sleep(1)print("\n")name=input("name: ")iflen(name)<1:name="level"print("bg = ",bg)print(name,"=",sprite)
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.