--888_______888___8888888___888888888888___888888888888_______8888____________88888______88_______888
--888_______888___8888888___888888888888___888888888888_______8888__________888888888____88_______888
--_888______88____8888888___888888888888___888888888888______888888________8888888888____88_______888
--_888_____888______888__________88_____________88___________888888_______8888_____88____88_______888
--_888_____888______888__________88_____________88___________88__88_______888____________88_______888
--__88_____88_______888__________88_____________88__________888__888______888____________88_______888
--__888___888_______888__________88_____________88__________888__888______88_____________888888888888
--__888___888_______888__________88_____________88__________88____888____888_____________888888888888
--___88___88________888__________88_____________88_________888____888_____88_____________888888888888
--___888_888________888__________88_____________88_________8888888888_____888____________88_______888
--___8888888________888__________88_____________88_________88888888888____888____________88_______888
--____88888_________888__________88_____________88________888888888888____8888_____88____88_______888
--____88888_______8888888________88_____________88________888______888_____8888888888____88_______888
--_____8888_______8888888________88_____________88_______888________888_____888888888____88_______888
--_____888________8888888________88_____________88_______888________888_______88888______88_______888

--VITTACH PRESENT--
--nastraivaemi igrovoi 2D dvizok--
--ia programist, delau igri na PSP--
--Etot igrovoi dvizok pomozet vam sozdavat svoi igri--

one=Image.load("data/pers/p1.png")--zagruzka kartinki na vremennuu peremennuu
two=Image.load("data/pers/p2.png")--zagruzka kartinki na vremennuu peremennuu
thrs=Image.load("data/pers/p3.png")--zagruzka kartinki na vremennuu peremennuu
fous=Image.load("data/pers/p4.png")--zagruzka kartinki na vremennuu peremennuu
sam=Image.load("data/pers/p16.png")--zagruzka kartinki na vremennuu peremennuu
extra=Image.load("data/pers/p15.png")--zagruzka kartinki na vremennuu peremennuu
fon=Image.load("data/img/fon.jpg")--zagruzka kartinki na vremennuu peremennuu
rip=Image.load("data/img/rip.png")--zagruzka kartinki na vremennuu peremennuu
box=Image.load("data/img/box.png")--zagruzka kartinki na vremennuu peremennuu
vrag=Image.load("data/pers/vrag.png")--zagruzka kartinki na vremennuu peremennuu
vrag2=Image.load("data/pers/vrag2.png")--zagruzka kartinki na vremennuu peremennuu
vrag3=Image.load("data/pers/vrag3.png")--zagruzka kartinki na vremennuu peremennuu
vrag4=Image.load("data/pers/vrag4.png")--zagruzka kartinki na vremennuu peremennuu
pul=Image.load("data/img/pul.png")--zagruzka kartinki na vremennuu peremennuu
goin=Image.load("data/img/goin.png")--zagruzka kartinki na vremennuu peremennuu
gun=Image.load("data/img/gun.png")--zagruzka kartinki na vremennuu peremennuu
gun2=Image.load("data/img/gun2.png")--zagruzka kartinki na vremennuu peremennuu
gun3=Image.load("data/img/gun3.png")--zagruzka kartinki na vremennuu peremennuu
gun4=Image.load("data/img/gun4.png")--zagruzka kartinki na vremennuu peremennuu
kub=Image.load("data/img/01.png")--zagruzka kartinki na vremennuu peremennuu
ten=Image.load("data/img/ten.png")--zagruzka kartinki na vremennuu peremennuu
mini=Image.load("data/img/mini.png")--zagruzka kartinki na vremennuu peremennuu
dom=Image.load("data/img/dom.png")--zagruzka kartinki na vremennuu peremennuu
dom2=Image.load("data/img/dom2.png")--zagruzka kartinki na vremennuu peremennuu
dom3=Image.load("data/img/dom3.png")--zagruzka kartinki na vremennuu peremennuu
doroga=Image.load("data/img/doroga.png")--zagruzka kartinki na vremennuu peremennuu
gras=Image.load("data/img/gras2.png")--zagruzka kartinki na vremennuu peremennuu
hper=Image.load("data/img/hp.png")--zagruzka kartinki na vremennuu peremennuu
hper2=Image.load("data/img/hp2.png")--zagruzka kartinki na vremennuu peremennuu
hp01=Image.load("data/img/hp/hp01.png")--zagruzka kartinki na vremennuu peremennuu
hp02=Image.load("data/img/hp/hp02.png")--zagruzka kartinki na vremennuu peremennuu
hp03=Image.load("data/img/hp/hp03.png")--zagruzka kartinki na vremennuu peremennuu
hp04=Image.load("data/img/hp/hp04.png")--zagruzka kartinki na vremennuu peremennuu
hp05=Image.load("data/img/hp/hp05.png")--zagruzka kartinki na vremennuu peremennuu
hp06=Image.load("data/img/hp/hp06.png")--zagruzka kartinki na vremennuu peremennuu
hp07=Image.load("data/img/hp/hp07.png")--zagruzka kartinki na vremennuu peremennuu
hp08=Image.load("data/img/hp/hp08.png")--zagruzka kartinki na vremennuu peremennuu
hp09=Image.load("data/img/hp/hp09.png")--zagruzka kartinki na vremennuu peremennuu
hp10=Image.load("data/img/hp/hp10.png")--zagruzka kartinki na vremennuu peremennuu
hp11=Image.load("data/img/hp/hp11.png")--zagruzka kartinki na vremennuu peremennuu
hp12=Image.load("data/img/hp/hp12.png")--zagruzka kartinki na vremennuu peremennuu
hp13=Image.load("data/img/hp/hp13.png")--zagruzka kartinki na vremennuu peremennuu
hp14=Image.load("data/img/hp/hp14.png")--zagruzka kartinki na vremennuu peremennuu
hp15=Image.load("data/img/hp/hp15.png")--zagruzka kartinki na vremennuu peremennuu
hp16=Image.load("data/img/hp/hp16.png")--zagruzka kartinki na vremennuu peremennuu
udar=Image.load("data/img/udar.png")--zagruzka kartinki na vremennuu peremennuu

function nill()--funkcia otchistki pamiati
ten=nil
udar=nil
dom2=nil
dom3=nil
hp01=nil
hp02=nil
hp03=nil
hp04=nil
hp05=nil
hp06=nil
hp07=nil
hp08=nil
hp09=nil
hp10=nil
hp11=nil
hp12=nil
hp13=nil
hp14=nil
hp15=nil
hp16=nil
one=nil
hper=nil
two=nil
thrs=nil
fous=nil
sam=nil
extra=nil
fon=nil
rip=nil
vrag=nil
vrag2=nil
pul=nili
gun=nil
gun2=nil
gun3=nil
gun4=nil
kub=nil
mini=nil
dom=nil
doroga=nil
gras=nil
opng=nil
end
function prizok()
oo=y
o=math.ceil(y-tonumber(visota))
u=1
end

zizn=17
yyyy=0
yyyz=0
yyy=30
sar=0
saz=0
rtrt=0
p=0
oo=0
o=0
u=0
zz=0
c=0
tt=1
bu=0
stu=0
qr=1
rtrt=0
sap=0
ik=0

font = Font.load("data/font/qwe3.ttf")--podgruzka chrifta
font:setPixelSizes(30,20)--zadanie razmera chriftu
font4 = Font.load("data/font/qwe3.ttf")
font4:setPixelSizes(30,10)
font40 = Font.load("data/font/qwe3.ttf")
font40:setPixelSizes(40,20)
qr=1-- tut idet prisvaivanie nekotorim elementam ih znachenii
mll=125
mnn=76
bulu=0
file=io.open("data/nastroi/jump.CPP","r")--otkritie storonnego faila
cross=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/left.CPP","r")--otkritie storonnego faila
left=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/right.CPP","r")--otkritie storonnego faila
right=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/fire.CPP","r")--otkritie storonnego faila
er=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/gravi.CPP","r")--gravitacia iz failika
gravi=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/save.CPP","r")--otkritie storonnego faila
peremennay=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
--file=io.open("data/nastroi/visota.CPP","r")--otkritie storonnego faila
visota=120
--file:close()--ostanovka schitivania
file=io.open("data/nastroi/dlina.CPP","r")--otkritie storonnego faila
dlina=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/chislo.CPP","r")--otkritie storonnego faila
chislo=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/skor.CPP","r")--otkritie storonnego faila
skor=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/bright.CPP","r")--otkritie storonnego faila
bright=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/poy.CPP","r")--otkritie storonnego faila
poy=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/kolvo.CPP","r")--otkritie storonnego faila
kolvo=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/skpul.CPP","r")--otkritie storonnego faila
skpul=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/sam.CPP","r")--otkritie storonnego faila
samold=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/shut.CPP","r")--otkritie storonnego faila
shut=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
file=io.open("data/nastroi/vrag.CPP","r")--otkritie storonnego faila
vragi=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania

local masx={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masxx={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masvv={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masvxv={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masvvv={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masvvvv={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masdom={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local hphp={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local hphph={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masv={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masvx={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masbb={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masbxb={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masbbb={tonumber(chislo)}--sozdanie odnomernogo massiva v kotorom opredelennoe mnou ranee chislo elementov
local masy={100}--sozdanie odnomernogo massiva v kotorom 100 elementov
masy[1]=80--prisvaivanie pervomu elementu massiva masy znachenie = 1
masx[1]=0
masxx[1]=197
hphp[1]=0
hphph[1]=0
masdom[1]=1

for i=2,chislo do--da sobsno i sozdau uroven
m=197
l = math.random(280,309)--kod dlia generacii sluchainogo chisla (l)
ll=1
lll=math.random(1,7)--kod dlia generacii sluchainogo chisla (lll)
lllk=math.random(1,10)--kod dlia generacii sluchainogo chisla (lllk)
llll=math.random(10,140)--kod dlia generacii sluchainogo chisla (llll)
lllll=math.random(1,40)--kod dlia generacii sluchainogo chisla (lllll)
llllll=math.random(1,40)--kod dlia generacii sluchainogo chisla (llllll)
r= math.random(80,200)--kod dlia razbrosa platform po y
hphp[i]=0
hphph[i]=0
if lllk==1 or lllk==3 or lllk==5 then
masdom[i]=1
end
if lllk==7 or lllk==2 or lllk==4 or lllk==9 then
masdom[i]=2
end
if lllk==6 or lllk==8 or lllk==10 then
masdom[i]=3
end
masx[i]=masx[i-1]+l--prisvaivanie massivu s tekuchim zacheniem dannix iz etogoze massive s prediduchim znacheniem
masxx[i]=masx[i]+m--prisvaivanie massivu s tekuchim zacheniem dannix etogoze massiva s tekuchim znacheniem + dannix peremennoi (m)
if lllk~=6 and lllk~=8 and lllk~=10 then
masy[i]=r--prisvaivanie massivu s tekuchim zacheniem dannix peremennoi (r)
else
masy[i]=60
end
if ll==1 and i>4 then
masvv[i]=masx[i]+lllll
masvxv[i]=masxx[i]-llllll
masbb[i]=219
masbxb[i]=219
vv=1
end
masv[i]=vv
masvx[i]=vv
vv=0
if lll==1 or lll==2 or lll==3 or lll==4 then
masvvv[i]=masx[i]+llll
masbbb[i]=262
vvv=1
end
masvvvv[i]=vvv
vvv=0
end
i=1
y=217

local pina={3}
local pinas={3}
local piina={3}
piinas=0
piina[1]=255--prisvaivanie 1 elementu massiva piina znachenia = 255
piina[2]=255--prisvaivanie 2 elementu massiva piina znachenia = 255
piina[3]=255--prisvaivanie 3 elementu massiva piina znachenia = 255
local gunx={tonumber(kolvo)}
local guny={tonumber(kolvo)}
local gunxx={tonumber(kolvo)}
local gunyy={tonumber(kolvo)}
local hh={tonumber(kolvo)}
for h=1,tonumber(kolvo) do--ustal ia ne hochu pisat,no tut voobchem dlia pulek
gunx[h]=-20
guny[h]=-20
hh[h]=0
end
h=1
local hhh={tonumber(kolvo)}
for hp=1,tonumber(kolvo) do--ustal ia ne hochu pisat,no tut voobchem dlia pulek
gunxx[hp]=-20
gunyy[hp]=-20
hhh[hp]=0
end
hp=1
pinas[1]=0
pinas[2]=0
pinas[3]=0
pina[1]=0
pina[2]=255
pina[3]=255
pl=0
pll=0
function lefte()
if x<z+masx[chislo-5] and z<0 then
z=z+tonumber(skor)--schetchik z kotorii kazdii raz umenchaetsia na chislo (skor)
end
if tt==1 then
tt=2
end
if x<z+masx[chislo-5] and x>z+masx[1] then
if c+480<=480 then
c=c+tonumber(fons)
else
c=-480
end
end
if x>10 and u==1 then
if x<z+masx[chislo-5] then
x=math.ceil(x-tonumber(dlina))
end
end
end
function righte()
--if x+20<z+masx[chislo-5] then
z=z-tonumber(skor)--schetchik z kotorii kazdii raz umenchaetsia na chislo (skor)
--end
if tt==1 or tt==2 or bu==1 or buu==1 then
--if x<z+masx[chislo-5] then
zz=zz+1/10
--end
end
--if x+20<z+masx[chislo-5] then
if c+480>=0 then
c=c-tonumber(fons)
else
c=0
end
--end
if tt==2 then
tt=1
end
if x<200 and u==1 then
if x+20<z+masx[chislo-5] then
x=math.ceil(x+tonumber(dlina))
end
end
end
function fire1()
tt=1
if tonumber(gunkol)>0 then
gunkol=gunkol-1
if h<tonumber(kolvo) then
h=h+1
else
h=1
end
guny[h]=y+27
gunx[h]=x+20
hh[h]=0--dolgo dumal kak ispravit ochibku,i v itoge dobavil etu stroku,htia ne ponimau zachem ona,no ona rabotaet !))
end
end
function fire2()
tt=2
if tonumber(gunkol)>0 then
gunkol=gunkol-1
if hp<tonumber(kolvo) then
hp=hp+1
else
hp=1
end
gunyy[hp]=y+27
gunxx[hp]=x-20
hhh[hp]=0--dolgo dumal kak ispravit ochibku,i v itoge dobavil etu stroku,htia ne ponimau zachem ona,no ona rabotaet !))
end
end
greenn=Color.new(0,255,0)

while true do--zapusk cikla
screen:clear()--ochistka ekrana
pad = Controls.read()--podgruzka knopok psp
if pizd==0 then
if pina[2]>0 and pinas[2]==0 then
pina[2]=pina[2]-bright
black=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
black=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
black=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
black=Color.new(pina[1],pina[2],pina[3])
elseif pina[1]>0 and pinas[1]==1 then
pina[1]=pina[1]-bright
black=Color.new(pina[1],pina[2],pina[3])
elseif pina[3]<255 and pinas[3]==1 then
pina[3]=pina[3]+bright
black=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

if piina[1]>0 and piinas==0 then
piina[1]=piina[1]-bright
piina[2]=piina[2]-bright
piina[3]=piina[3]-bright
blackk=Color.new(piina[1],piina[2],piina[3])
else
piinas=1
end
if piina[1]<255 and piinas==1 then
piina[1]=piina[1]+bright
piina[2]=piina[2]+bright
piina[3]=piina[3]+bright
blackk=Color.new(piina[1],piina[2],piina[3])
else
piinas=0
end

--if c+480>=0 then
--c=c-tonumber(fons)
--else
--c=0
--end
p=p+1
screen:blit(c,0,fon)--raspechatka izobrazenia fon po koordinatam c,0
screen:blit(c+480,0,fon)--raspechatka izobrazenia fon po koordinatam c+480,0

if ik<tonumber(chislo) then
ik=ik+1
else
ik=1
end
if masv[ik]==1 then
if x<(z+masvv[ik])+saz then
sap=0
sar=0
else
sap=1
end
end

--z=z-tonumber(skor)--schetchik z kotorii kazdii raz umenchaetsia na chislo (skor)
--if tt==1 or tt==2 or bu==1 or buu==1 then
--if stu==1 or tt==4 then
--zz=zz+1
--else
--zz=zz+1/10
--end
--end

if sar==0 and sap==0 then
saz=saz-tonumber(vragi)
end

for i=1,chislo do--dlia travi i domov
screen:blit((z+masxx[i])+1,230,gras)
if masdom[i]==1 then
screen:blit((z+masx[i]),(yyyy+masy[i])+1,dom)
elseif masdom[i]==2 then
screen:blit((z+masx[i]),(yyyy+masy[i])+1,dom2)
elseif masdom[i]==3 then
screen:blit((z+masx[i]),(yyyy+masy[i])+1,dom3)
if x+20>=(z+masx[i])+80 and x<=(z+masx[i])+120 and y>=217 then
screen:blit((z+masx[i])+55,(yyyy+masy[i])+100,goin)
if pad:circle() then
dofile("data/scripts/e.cpp")
end
end
end
end

screen:blit(c,252,doroga)
screen:blit(c+480,252,doroga)

for i=1,chislo do--raspechativau bliat platformi))

if x+20>z+masx[i] and x<z+masxx[i] and y+53>=yyyy+(masy[i]-math.ceil(tonumber(gravi))) and y+53<=yyyy+(masy[i]+math.ceil(tonumber(gravi))) then
y=math.ceil(y-tonumber(gravi))--blok gravitacii na platforme
if cross=="cross" then
if pad:cross() and oldpad:cross()~=pad:cross() then
prizok()
end
end
if cross=="circle" then
if pad:circle() and oldpad:circle()~=pad:circle() then
prizok()
end
end
if cross=="square" then
if pad:square() and oldpad:square()~=pad:square() then
prizok()
end
end
if cross=="triangle" then
if pad:triangle() and oldpad:triangle()~=pad:triangle() then
prizok()
end
end
if cross=="down" then
if pad:down() and oldpad:down()~=pad:down() then
prizok()
end
end
if cross=="left" then
if pad:left() and oldpad:left()~=pad:left() then
prizok()
end
end
if cross=="right" then
if pad:right() and oldpad:right()~=pad:right() then
prizok()
end
end
if cross=="up" then
if pad:up() and oldpad:up()~=pad:up() then
prizok()
end
end
if cross=="r" then
if pad:r() and oldpad:r()~=pad:r() then
prizok()
end
end
if cross=="l" then
if pad:l() and oldpad:l()~=pad:l() then
prizok()
end
end
end

screen:drawLine((z+masx[i])+1,yyyy+masy[i],z+masxx[i],yyyy+masy[i],blackk)--raspechatka linii s massivnimi koordinatami i cvetom BLACK
--screen:blit(z+masx[chislo-5],130,box)
if shut=="1" then
if masvvvv[i]==1 then
screen:blit(z+masvvv[i],masbbb[i],kub)
if x>=z+(masvvv[i]) and x<=(z+masvvv[i])+(10) and y>(masbbb[i]-53) and y<(masbbb[i]+10) then
gunkol=gunkol+10
masbbb[i]=300
end
end
end
if masv[i]==1 then
if (gunx[h]+hh[h])+10>=(z+masvv[i])+saz and guny[h]>=masbb[i] and guny[h]<=(masbb[i])+53 then
hphp[i]=hphp[i]+1
guny[h]=300
end
if (gunxx[hp]+hhh[hp])+10>=(z+masvv[i])+saz and gunyy[hp]>=masbb[i] and gunyy[hp]<=(masbb[i])+53 then
hphp[i]=hphp[i]+1
gunyy[hp]=300
end
if sar==0 then
--screen:fillRect((z+masvv[i])+saz,masbb[i]-5,((z+masvv[i])+saz)+8, masbb[i]-2,greenn)
if hphp[i]==0 then
screen:blit((z+masvv[i])+saz,(masbb[i])-5,hper)
elseif hphp[i]>=1 then
screen:blit((z+masvv[i])+saz,(masbb[i])-5,hper2)
end
if hphp[i]==0 then
screen:blit((z+masvv[i])+saz,masbb[i],vrag)
else
screen:blit((z+masvv[i])+saz,yyyy+masbb[i],vrag3)
end
end
--if hphp[i]>=1 then
--hphp[i]=hphp[i]+1
--end
if hphp[i]>=1 then
masbb[i]=300
end
end

if masvx[i]==1 then
if (gunx[h]+hh[h])+10>=(z+masvxv[i])+saz and guny[h]>=masbxb[i] and guny[h]<=(masbxb[i])+53 then
hphph[i]=hphph[i]+1
guny[h]=300
end
if (gunxx[hp]+hhh[hp])+10>=(z+masvxv[i])+saz and gunyy[hp]>=masbxb[i] and gunyy[hp]<=(masbxb[i])+53 then
hphph[i]=hphph[i]+1
gunyy[hp]=300
end
if sar==0 then
--screen:fillRect((z+masvxv[i])+saz,masbxb[i]-5,((z+masvxv[i])+saz)+8, masbxb[i]-2,greenn)
if hphph[i]==0 then
screen:blit((z+masvxv[i])+saz,(masbxb[i])-5,hper)
elseif hphph[i]>=1 then
screen:blit((z+masvxv[i])+saz,(masbxb[i])-5,hper2)
end
if hphph[i]==0 then
screen:blit((z+masvxv[i])+saz,masbxb[i],vrag)
else
screen:blit((z+masvxv[i])+saz,masbxb[i],vrag3)
end
end
--if hphph[i]>=1 then
--hphph[i]=hphph[i]+1
--end
if hphph[i]>=1 then
masbxb[i]=300
end
end
end

if y+53==270 then
y=math.ceil(y-tonumber(gravi))--blok gravitacii na doroge
end

if y+53>=260 then
if cross=="cross" then
if pad:cross() and oldpad:cross()~=pad:cross() then
prizok()
end
end
if cross=="circle" then
if pad:circle() and oldpad:circle()~=pad:circle() then
prizok()
end
end
if cross=="square" then
if pad:square() and oldpad:square()~=pad:square() then
prizok()
end
end
if cross=="triangle" then
if pad:triangle() and oldpad:triangle()~=pad:triangle() then
prizok()
end
end
if cross=="down" then
if pad:down() and oldpad:down()~=pad:down() then
prizok()
end
end
if cross=="left" then
if pad:left() and oldpad:left()~=pad:left() then
prizok()
end
end
if cross=="right" then
if pad:right() and oldpad:right()~=pad:right() then
prizok()
end
end
if cross=="up" then
if pad:up() and oldpad:up()~=pad:up() then
prizok()
end
end
if cross=="r" then
if pad:r() and oldpad:r()~=pad:r() then
prizok()
end
end
if cross=="l" then
if pad:l() and oldpad:l()~=pad:l() then
prizok()
end
end
end

if yyyz==0 then--podiem platform
if y<=oo then
yyyy=yyyy-tonumber(poy)
end
end

screen:blit(0,0,ten)
screen:blit(0,0,mini)
screen:fontPrint(font,350,22,"SCORE :",black)
screen:fontPrint(font,440,22,math.ceil(zz),black)
screen:fontPrint(font4,350,37,"BEST :",black)
screen:fontPrint(font4,420,37,peremennay,black)
if shut=="1" then
screen:fontPrint(font40,20,30,"GUN :",black)
screen:fontPrint(font40,80,30,math.ceil(tonumber(gunkol)),black)
end

if y+53<=275 and u==0 and stu==0 then
if tt==1 or tt==2 then
y=math.ceil(y+tonumber(gravi))--gravitacia
end
end

if u==1 then
if y>=o then
y=math.ceil(y-tonumber(gravi))
yyyz=1
yyyy=yyyy+tonumber(poy)--spusk platform
end
if y<=o or y<=-40 then
yyyz=0
u=0
end
end
if tt==1 or tt==2 then
if right=="cross" then
if pad:cross() then
righte()
end
end
if right=="circle" then
if pad:circle() then
righte()
end
end
if right=="square" then
if pad:square() then
righte()
end
end
if right=="triangle" then
if pad:triangle() then
righte()
end
end
if right=="down" then
if pad:down() then
righte()
end
end
if right=="left" then
if pad:left() then
righte()
end
end
if right=="right" then
if pad:right() then
righte()
end
end
if right=="up" then
if pad:up() then
righte()
end
end
if right=="r" then
if pad:r() then
righte()
end
end
if right=="l" then
if pad:l() then
righte()
end
end
if left=="cross" then
if pad:cross() then
lefte()
end
end
if left=="circle" then
if pad:circle() then
lefte()
end
end
if left=="square" then
if pad:square() then
lefte()
end
end
if left=="triangle" then
if pad:triangle() then
lefte()
end
end
if left=="down" then
if pad:down() then
lefte()
end
end
if left=="right" then
if pad:right() then
lefte()
end
end
if left=="left" then
if pad:left() then
lefte()
end
end
if left=="up" then
if pad:up() then
lefte()
end
end
if left=="r" then
if pad:r() then
lefte()
end
end
if left=="l" then
if pad:l() then
lefte()
end
end
end

if pad:start() then
screen:save("data/img/o.jpg")
opng=Image.load("data/img/o.jpg")
pizd=1
end

if shut=="1" then
if tt==1 then--tut prosto magia strelialka
if er=="cross" then
if pad:cross() and oldpad:cross()~=pad:cross() then
fire1()
end
end
if er=="circle" then
if pad:circle() and oldpad:circle()~=pad:circle() then
fire1()
end
end
if er=="square" then
if pad:square() and oldpad:square()~=pad:square() then
fire1()
end
end
if er=="triangle" then
if pad:triangle() and oldpad:triangle()~=pad:triangle() then
fire1()
end
end
if er=="down" then
if pad:down() and oldpad:down()~=pad:down() then
fire1()
end
end
if er=="left" then
if pad:left() and oldpad:left()~=pad:left() then
fire1()
end
end
if er=="right" then
if pad:right() and oldpad:right()~=pad:right() then
fire1()
end
end
if er=="up" then
if pad:up() and oldpad:up()~=pad:up() then
fire1()
end
end
if er=="r" then
if pad:r() and oldpad:r()~=pad:r() then
fire1()
end
end
if er=="l" then
if pad:l() and oldpad:l()~=pad:l() then
fire1()
end
end
end

if tt==2 then--tut prosto magia strelialka
if er=="cross" then
if pad:cross() and oldpad:cross()~=pad:cross() then
fire2()
end
end
if er=="circle" then
if pad:circle() and oldpad:circle()~=pad:circle() then
fire2()
end
end
if er=="square" then
if pad:square() and oldpad:square()~=pad:square() then
fire2()
end
end
if er=="triangle" then
if pad:triangle() and oldpad:triangle()~=pad:triangle() then
fire2()
end
end
if er=="down" then
if pad:down() and oldpad:down()~=pad:down() then
fire2()
end
end
if er=="left" then
if pad:left() and oldpad:left()~=pad:left() then
fire2()
end
end
if er=="right" then
if pad:right() and oldpad:right()~=pad:right() then
fire2()
end
end
if er=="up" then
if pad:up() and oldpad:up()~=pad:up() then
fire2()
end
end
if er=="r" then
if pad:r() and oldpad:r()~=pad:r() then
fire2()
end
end
if er=="l" then
if pad:l() and oldpad:l()~=pad:l() then
fire2()
end
end
end

for h=1,tonumber(kolvo) do--strelba pulami
if gunx[h]+hh[h]<480 then
hh[h]=hh[h]+tonumber(skpul)
else
guny[h]=300
end
screen:blit(gunx[h]+hh[h],guny[h],pul)
end
for hp=1,tonumber(kolvo) do--strelba pulami
if gunx[hp]+hhh[hp]>0 then
hhh[hp]=hhh[hp]-tonumber(skpul)
else
gunyy[hp]=300
end
screen:blit(gunxx[hp]+hhh[hp],gunyy[hp],pul)
end
end

for i=5,chislo do
if x>=z+(masvv[i]+saz) and x<=(z+masvv[i])+(25+saz) and y>(masbb[i]-53) and y<(masbb[i]+10) or x>=z+(masvxv[i]+saz) and x<=(z+masvxv[i])+(25+saz) and y>(masbxb[i]-53) and y<(masbxb[i]+10) then
if zizn>0 then
screen:blit(0,0,udar)
zizn=zizn-1
else
tt=3
end
else
bb=0
end
end

if tt==3 then
rtrt=rtrt+1
end
if rtrt>1 then
screen:save("data/img/o.jpg")
opng=Image.load("data/img/o.jpg")
bb=1
bulu=1
pizd=1
qr=2
end

--raspechatka persanaza
if bulu==0 then
if tt==1 then
if shut=="1" then
if tonumber(gunkol)>0 then
screen:blit(x+14,y+26,gun)
end
if pad:r() and oldpad:r()~=pad:r() then
if tonumber(gunkol)>0 then
screen:blit(x+25,y+22,gun3)
end
end
end
if p>=1 and p<10 then
if zizn==17 then
screen:blit(x,y-5,hper)
elseif zizn==16 then
screen:blit(x,y-5,hp01)
elseif zizn==15 then
screen:blit(x,y-5,hp02)
elseif zizn==14 then
screen:blit(x,y-5,hp03)
elseif zizn==13 then
screen:blit(x,y-5,hp04)
elseif zizn==12 then
screen:blit(x,y-5,hp05)
elseif zizn==11 then
screen:blit(x,y-5,hp06)
elseif zizn==10 then
screen:blit(x,y-5,hp07)
elseif zizn==9 then
screen:blit(x,y-5,hp08)
elseif zizn==8 then
screen:blit(x,y-5,hp09)
elseif zizn==7 then
screen:blit(x,y-5,hp10)
elseif zizn==6 then
screen:blit(x,y-5,hp11)
elseif zizn==5 then
screen:blit(x,y-5,hp12)
elseif zizn==4 then
screen:blit(x,y-5,hp13)
elseif zizn==3 then
screen:blit(x,y-5,hp14)
elseif zizn==2 then
screen:blit(x,y-5,hp15)
elseif zizn<=1 then
screen:blit(x,y-5,hp16)
end
screen:blit(x,y,one)
end
if p>=10 and p<20 then
if zizn==17 then
screen:blit(x,y-5,hper)
elseif zizn==16 then
screen:blit(x,y-5,hp01)
elseif zizn==15 then
screen:blit(x,y-5,hp02)
elseif zizn==14 then
screen:blit(x,y-5,hp03)
elseif zizn==13 then
screen:blit(x,y-5,hp04)
elseif zizn==12 then
screen:blit(x,y-5,hp05)
elseif zizn==11 then
screen:blit(x,y-5,hp06)
elseif zizn==10 then
screen:blit(x,y-5,hp07)
elseif zizn==9 then
screen:blit(x,y-5,hp08)
elseif zizn==8 then
screen:blit(x,y-5,hp09)
elseif zizn==7 then
screen:blit(x,y-5,hp10)
elseif zizn==6 then
screen:blit(x,y-5,hp11)
elseif zizn==5 then
screen:blit(x,y-5,hp12)
elseif zizn==4 then
screen:blit(x,y-5,hp13)
elseif zizn==3 then
screen:blit(x,y-5,hp14)
elseif zizn==2 then
screen:blit(x,y-5,hp15)
elseif zizn<=1 then
screen:blit(x,y-5,hp16)
end
screen:blit(x,y,two)
end
if p>=20 then
p=0
end
end

if tt==2 then
if shut=="1" then
if tonumber(gunkol)>0 then
screen:blit(x-5,y+26,gun2)
end
if pad:r() and oldpad:r()~=pad:r() then
if tonumber(gunkol)>0 then
screen:blit(x-10,y+22,gun4)
end
end
end
if p>=1 and p<10 then
if zizn==17 then
screen:blit(x,y-5,hper)
elseif zizn==16 then
screen:blit(x,y-5,hp01)
elseif zizn==15 then
screen:blit(x,y-5,hp02)
elseif zizn==14 then
screen:blit(x,y-5,hp03)
elseif zizn==13 then
screen:blit(x,y-5,hp04)
elseif zizn==12 then
screen:blit(x,y-5,hp05)
elseif zizn==11 then
screen:blit(x,y-5,hp06)
elseif zizn==10 then
screen:blit(x,y-5,hp07)
elseif zizn==9 then
screen:blit(x,y-5,hp08)
elseif zizn==8 then
screen:blit(x,y-5,hp09)
elseif zizn==7 then
screen:blit(x,y-5,hp10)
elseif zizn==6 then
screen:blit(x,y-5,hp11)
elseif zizn==5 then
screen:blit(x,y-5,hp12)
elseif zizn==4 then
screen:blit(x,y-5,hp13)
elseif zizn==3 then
screen:blit(x,y-5,hp14)
elseif zizn==2 then
screen:blit(x,y-5,hp15)
elseif zizn<=1 then
screen:blit(x,y-5,hp16)
end
screen:blit(x,y,thrs)
end
if p>=10 and p<20 then
if zizn==17 then
screen:blit(x,y-5,hper)
elseif zizn==16 then
screen:blit(x,y-5,hp01)
elseif zizn==15 then
screen:blit(x,y-5,hp02)
elseif zizn==14 then
screen:blit(x,y-5,hp03)
elseif zizn==13 then
screen:blit(x,y-5,hp04)
elseif zizn==12 then
screen:blit(x,y-5,hp05)
elseif zizn==11 then
screen:blit(x,y-5,hp06)
elseif zizn==10 then
screen:blit(x,y-5,hp07)
elseif zizn==9 then
screen:blit(x,y-5,hp08)
elseif zizn==8 then
screen:blit(x,y-5,hp09)
elseif zizn==7 then
screen:blit(x,y-5,hp10)
elseif zizn==6 then
screen:blit(x,y-5,hp11)
elseif zizn==5 then
screen:blit(x,y-5,hp12)
elseif zizn==4 then
screen:blit(x,y-5,hp13)
elseif zizn==3 then
screen:blit(x,y-5,hp14)
elseif zizn==2 then
screen:blit(x,y-5,hp15)
elseif zizn<=1 then
screen:blit(x,y-5,hp16)
end
screen:blit(x,y,fous)
end
if p>=20 then
p=0
end
end
end

--konec raspechatki

if masx[tonumber(chislo)]+z<0 then
file=io.open("data/nastroi/save.CPP","w")
file:write(math.ceil(zz))
file:close()
System.message("You WIN! Are you ready for the final battle?",0)
file=io.open("data/makesave/save24.msn","w")
file:write(5)
file:close()
nill()
dofile("data/load/load.cpp")
end
end

if pizd==1 then
screen:blit(0,0,opng)
screen:blit(mll,mnn,pause)
if pad:down() and oldpad:down()~=pad:down() then
qr=qr+1
end
if pad:up() and oldpad:up()~=pad:up() then
qr=qr-1
end
if qr>3 then
qr=1
end
if qr<1 then
qr=3
end
if qr==1 then
screen:blit(mll+35,mnn+30,ukaz)
if pad:cross() then
if bulu==1 then
qr=2
else
pizd=0
end
end
end
if qr==2 then
screen:blit(mll+35,mnn+54,ukaz)
if pad:cross() then
file=io.open("data/nastroi/save.CPP","w")
file:write(math.ceil(zz))
file:close()
pizd=0
p=0
oo=0
o=0
u=0
zz=0
c=0
tt=1
bu=0
stu=0
qr=1
rtrt=0
zxz=0
z=0
file=io.open("data/nastroi/gun.CPP","r")--otkritie storonnego faila
gunkol=file:read()--kod dlia ego schitivania
file:close()--ostanovka schitivania
nill()
dofile("data/scripts/c.cpp")
end
end
if qr==3 then
screen:blit(mll+35,mnn+78,ukaz)
if pad:cross() then
nill()
dofile("data/scripts/script.cpp")
end
end
if bulu==1 then
screen:blit(x,y+43,extra)
if x>=100 then
screen:blit(x-100,222,rip)
else
screen:blit(x+100,222,rip)
end
end
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

--888_______888___8888888___888888888888___888888888888_______8888____________88888______88_______888
--888_______888___8888888___888888888888___888888888888_______8888__________888888888____88_______888
--_888______88____8888888___888888888888___888888888888______888888________8888888888____88_______888
--_888_____888______888__________88_____________88___________888888_______8888_____88____88_______888
--_888_____888______888__________88_____________88___________88__88_______888____________88_______888
--__88_____88_______888__________88_____________88__________888__888______888____________88_______888
--__888___888_______888__________88_____________88__________888__888______88_____________888888888888
--__888___888_______888__________88_____________88__________88____888____888_____________888888888888
--___88___88________888__________88_____________88_________888____888_____88_____________888888888888
--___888_888________888__________88_____________88_________8888888888_____888____________88_______888
--___8888888________888__________88_____________88_________88888888888____888____________88_______888
--____88888_________888__________88_____________88________888888888888____8888_____88____88_______888
--____88888_______8888888________88_____________88________888______888_____8888888888____88_______888
--_____8888_______8888888________88_____________88_______888________888_____888888888____88_______888
--_____888________8888888________88_____________88_______888________888_______88888______88_______88888