--__88888__888888_88888888___888888____888____888___888__888888
--88____8__88________88_____88____8____888____888___888__88
--88_______88________88____88__________8_8____888___888__88
--8888_____88________88____88_________88_88___8888_8888__88
--_888888__888888____88____88_________88__8___88_888_88__888888
--___8888__88________88____88__8888___8___8___88_888_88__88
--______8__88________88____88____88__8888888__88__8__88__88
--8____88__88________88_____88___88__88___88__88_____88__88
--888888___888888____88______888888_88_____88_88_____88__888888

left=Image.load("data/img/left.png")
right=Image.load("data/img/right.png")
lefts=Image.load("data/img/lefts.png")
rights=Image.load("data/img/rights.png")
circl=Image.load("data/img/circl.png")
font3 = Font.load("data/font/qwe2.ttf")
font3:setPixelSizes(30,30)
font6 = Font.load("data/font/qwe2.ttf")
font6:setPixelSizes(30,30)
font = Font.load("data/font/qwe.ttf")
font:setPixelSizes(20,20)
kn3=Image.load("data/img/kn3.png")
file=io.open("data/nastroi/save.CPP","r")
peremennay=file:read()
file:close()
file=io.open("data/nastroi/chislo.CPP","r")
chislo=file:read()
file:close()
file=io.open("data/nastroi/visota.CPP","r")
visota=file:read()
file:close()
file=io.open("data/nastroi/dlina.CPP","r")
dlina=file:read()
file:close()
file=io.open("data/nastroi/skor.CPP","r")
skor=file:read()
file:close()
file=io.open("data/nastroi/gravi.CPP","r")
gravi=file:read()
file:close()
file=io.open("data/nastroi/bright.CPP","r")
bright=file:read()
file:close()
file=io.open("data/nastroi/poy.CPP","r")
poy=file:read()
file:close()
file=io.open("data/nastroi/kolvo.CPP","r")
kolvo=file:read()
file:close()
file=io.open("data/nastroi/skpul.CPP","r")
skpul=file:read()
file:close()
file=io.open("data/nastroi/sam.CPP","r")
samold=file:read()
file:close()
file=io.open("data/nastroi/shut.CPP","r")
shut=file:read()
file:close()
file=io.open("data/nastroi/vrag.CPP","r")
vragi=file:read()
file:close()
file=io.open("data/nastroi/fon.CPP","r")
fons=file:read()
file:close()
file=io.open("data/makesave/save24.msn","r")
uroven=file:read()
file:close()
file=io.open("data/nastroi/gun.CPP","r")
gunkol=file:read()
file:close()
file=io.open("data/nastroi/mensam.cpp","r")
mensam=file:read()
file:close()
shuts=tonumber(shut)
qr=50
local pina={3}
local pinas={3}
pinas[1]=0
pinas[2]=0
pinas[3]=0
pina[1]=0
pina[2]=255
pina[3]=255
function nill()
left=nil
circl=nil
right=nil
lefts=nil
rights=nil
font6=nil
font3=nil
font=nil
kn3=nil
end

while true do
if iii<255 and ii==0 then
iii=iii+tonumber(bright)
else
ii=1
end
if iii>0 and ii==1 then
iii=iii-tonumber(bright)
else
ii=0
end
rnds=Color.new(iii,0,0)
if pina[2]>0 and pinas[2]==0 then--perelivanie cvetov
pina[2]=pina[2]-bright
rnd=Color.new(pina[1],pina[2],pina[3])
elseif pina[1]<255 and pinas[1]==0 then
pinas[2]=1
pina[1]=pina[1]+bright
rnd=Color.new(pina[1],pina[2],pina[3])
elseif pina[3]>0 and pinas[3]==0 then
pinas[1]=1
pina[3]=pina[3]-bright
rnd=Color.new(pina[1],pina[2],pina[3])
elseif pina[2]<255 and pinas[2]==1 then
pinas[3]=1
pina[2]=pina[2]+bright
rnd=Color.new(pina[1],pina[2],pina[3])
elseif pina[1]>0 and pinas[1]==1 then
pina[1]=pina[1]-bright
rnd=Color.new(pina[1],pina[2],pina[3])
elseif pina[3]<255 and pinas[3]==1 then
pina[3]=pina[3]+bright
rnd=Color.new(pina[1],pina[2],pina[3])
else
pinas[1]=0
pinas[2]=0
pinas[3]=0
pina[1]=0
pina[2]=255
pina[3]=255
end

screen:clear()
pad = Controls.read()
if pad:down() and oldpad:down()~=pad:down() then
qr=qr+50
end
if pad:up() and oldpad:up()~=pad:up() then
qr=qr-50
end
if qr>850 then
qr=0
end
if qr<0 then
qr=850
end
if c+480>=0 then
c=c-tonumber(fons)
else
c=0
end
screen:blit(0,0,fonmenu)
--screen:blit(c+480,0,fon)
screen:blit(0,84,kn3)
if qr~=800 and qr~=850 then
screen:blit(81,92,left)
screen:blit(161,92,right)
if pad:right() then screen:blit(158,89,rights) end
if pad:left() then screen:blit(78,89,lefts) end
end

if qr==0 then
if pad:right() then
if tonumber(chislo)<500 then
chislo=chislo+1
end
end
if pad:left() then
if tonumber(chislo)>25 then
chislo=chislo-1
end
end
end

if qr==50 then
if pad:right() then
if tonumber(visota)<200 then
visota=visota+1
end
end
if pad:left() then
if tonumber(visota)>50 then
visota=visota-1
end
end
end

if qr==100 then
--screen:blit(90,195,ukaz)
if pad:right() then
if tonumber(dlina)<10 then
dlina=dlina+1
end
end
if pad:left() then
if tonumber(dlina)>1 then
dlina=dlina-1
end
end
end

if qr==150 then
--screen:blit(90,245,ukaz)
if pad:right() then
if tonumber(skor)<30 then
skor=skor+1
end
end
if pad:left() then
if tonumber(skor)>1 then
skor=skor-1
end
end
end

if qr==200 then
if pad:right() then
if tonumber(bright)<255 then
bright=bright+1
end
end
if pad:left() then
if tonumber(bright)>0 then
bright=bright-1
end
end
end

if qr==250 then
if pad:right() then
if tonumber(gravi)<30 then
gravi=gravi+1
end
end
if pad:left() then
if tonumber(gravi)>0 then
gravi=gravi-1
end
end
end

if qr==300 then
if pad:right() then
if tonumber(poy)<10 then
poy=poy+1
end
end
if pad:left() then
if tonumber(poy)>0 then
poy=poy-1
end
end
end

if qr==350 then
if pad:right() then
if tonumber(kolvo)<100 then
kolvo=kolvo+1
end
end
if pad:left() then
if tonumber(kolvo)>1 then
kolvo=kolvo-1
end
end
end

if qr==400 then
if pad:right() then
if tonumber(skpul)<30 then
skpul=skpul+1
end
end
if pad:left() then
if tonumber(skpul)>1 then
skpul=skpul-1
end
end
end

if qr==450 then
if pad:right() then
if tonumber(samold)<30 then
samold=samold+1
end
end
if pad:left() then
if tonumber(samold)>1 then
samold=samold-1
end
end
end

if qr==500 then
if pad:right() then
if tonumber(shuts)<1 then
shuts=shuts+1
end
end
if pad:left() then
if tonumber(shuts)>0 then
shuts=shuts-1
end
end
end

if qr==550 then
if pad:right() then
if tonumber(vragi)<10 then
vragi=vragi+1
end
end
if pad:left() then
if tonumber(vragi)>0 then
vragi=vragi-1
end
end
end

if qr==600 then
if pad:right() then
if tonumber(fons)<50 then
fons=fons+1
end
end
if pad:left() then
if tonumber(fons)>0 then
fons=fons-1
end
end
end

if qr==650 then
if pad:right() then
if tonumber(mensam)<4 then
mensam=mensam+1
end
end
if pad:left() then
if tonumber(mensam)>0 then
mensam=mensam-1
end
end
end

if qr==700 then
if pad:right() then
if tonumber(gunkol)<50 then
gunkol=gunkol+1
end
end
if pad:left() then
if tonumber(gunkol)>0 then
gunkol=gunkol-1
end
end
end

if qr==750 then
if pad:right() then
if tonumber(uroven)<5 then
uroven=uroven+1
end
end
if pad:left() then
if tonumber(uroven)>1 then
uroven=uroven-1
end
end
end

if qr<=50 then
screen:fontPrint(font3,101,110-qr,chislo,red)
screen:fontPrint(font,191,108-qr,"Chislo Platform",red)
end
if qr<=100 then
screen:fontPrint(font3,101,160-qr,visota,red)
screen:fontPrint(font,191,158-qr,"Visota Prizka",red)
end
if qr<=150 then
screen:fontPrint(font3,101,210-qr,dlina,red)
screen:fontPrint(font,191,208-qr,"Dlina Prizka",red)
end
if qr<=200 then
screen:fontPrint(font3,101,260-qr,skor,red)
screen:fontPrint(font,191,258-qr,"Skorost Platform",red)
end
if qr<=250 then
screen:fontPrint(font3,101,310-qr,bright,red)
screen:fontPrint(font,191,308-qr,"Skorost smeni cveta linii",red)
end
if qr<=300 then
screen:fontPrint(font3,101,360-qr,gravi,red)
screen:fontPrint(font,191,358-qr,"Skorost Gravitacii",red)
end
if qr<=350 then
screen:fontPrint(font3,101,410-qr,poy,red)
screen:fontPrint(font,191,408-qr,"Skorost spuska platform",red)
end
if qr<=400 then
screen:fontPrint(font3,101,460-qr,kolvo,red)
screen:fontPrint(font,191,458-qr,"Kolichestvo pul pri vistrele",red)
end
if qr<=450 then
screen:fontPrint(font3,101,510-qr,skpul,red)
screen:fontPrint(font,191,508-qr,"Skorost pul",red)
end
if qr<=500 then
screen:fontPrint(font3,101,560-qr,samold,red)
screen:fontPrint(font,191,558-qr,"Skorost podiema/spuska samoleta",red)
end
if qr<=600 then
screen:fontPrint(font3,101,660-qr,vragi,red)
screen:fontPrint(font,191,658-qr,"Skorost peremechenia vraga",red)
end
if qr<=650 then
screen:fontPrint(font3,101,710-qr,fons,red)
screen:fontPrint(font,191,708-qr,"Skorost peremechenia fona",red)
end
if qr<=700 then
screen:fontPrint(font3,101,760-qr,mensam,red)
screen:fontPrint(font,191,758-qr,"Kol-vo samoletov v menu",red)
end
if qr<=750 then
screen:fontPrint(font3,101,810-qr,gunkol,red)
screen:fontPrint(font,191,808-qr,"Kol-vo patronov",red)
end
if qr<=800 then
screen:fontPrint(font3,101,860-qr,uroven,red)
screen:fontPrint(font,191,858-qr,"Vibor urovnia",red)
end
if qr<=850 then
screen:fontPrint(font,40,908-qr,"if you press cross,you deleted saves",red)
if pad:cross() and qr==800 then
System.message("Do you want to deleted your saves?", 1)
if System.buttonPressed(0) == 1 then
file=io.open("data/makesave/save24.msn","w")
file:write(1)
file:close()
System.message("^_^ Save deleted ^_^",0)
end
end
end
if qr<=900 then
screen:fontPrint(font,200,957-qr,"SCORE:" .. math.ceil(peremennay),red)
end

if qr<=550 then
if shuts==1 then
screen:fontPrint(font3,101,610-qr,"ON",red)
else
screen:fontPrint(font3,101,610-qr,"OFF",red)
end
screen:fontPrint(font,191,608-qr,"On/Off shuter",red)
end

screen:fontPrint(font6,195,23,"Settings",rnds)
--screen:fontPrint(font3,150,75,"SCORE :",rnds)
--screen:fontPrint(font3,270,75,math.ceil(peremennay),rnds)
screen:blit(428,220,circl)

if pad:circle()  then
file=io.open("data/nastroi/chislo.CPP","w")
file:write(tonumber(chislo))
file:close()
file=io.open("data/nastroi/visota.CPP","w")
file:write(tonumber(visota))
file:close()
file=io.open("data/nastroi/dlina.CPP","w")
file:write(tonumber(dlina))
file:close()
file=io.open("data/nastroi/skor.CPP","w")
file:write(tonumber(skor))
file:close()
file=io.open("data/nastroi/bright.CPP","w")
file:write(tonumber(bright))
file:close()
file=io.open("data/nastroi/gravi.CPP","w")
file:write(tonumber(gravi))
file:close()
file=io.open("data/nastroi/poy.CPP","w")
file:write(tonumber(poy))
file:close()
file=io.open("data/nastroi/kolvo.CPP","w")
file:write(tonumber(kolvo))
file:close()
file=io.open("data/nastroi/skpul.CPP","w")
file:write(tonumber(skpul))
file:close()
file=io.open("data/nastroi/sam.CPP","w")
file:write(tonumber(samold))
file:close()
file=io.open("data/nastroi/shut.CPP","w")
file:write(tonumber(shuts))
file:close()
file=io.open("data/nastroi/vrag.CPP","w")
file:write(tonumber(vragi))
file:close()
file=io.open("data/nastroi/fon.CPP","w")
file:write(tonumber(fons))
file:close()
file=io.open("data/nastroi/mensam.CPP","w")
file:write(tonumber(mensam))
file:close()
file=io.open("data/nastroi/gun.CPP","w")
file:write(tonumber(gunkol))
file:close()
file=io.open("data/makesave/save24.msn","w")
file:write(tonumber(uroven))
file:close()
font=nil
nill()
dofile("data/scripts/setting.cpp")
end
if pad:select() then
file=io.open("data/makesave/screenshoter.msn","r")
nscreen=tonumber(file:read())
file:close()
screen:save("data/screenshot/SHOT"..nscreen..".png")
nscreen=nscreen+1
file=io.open("data/makesave/screenshoter.msn","w")
file:write(math.ceil(nscreen))
file:close()
end
screen:flip()
oldpad=pad
end