graphics
treki
pause 2
randomize
OPTION BASE 1
OPTION ANGLE DEGREES
OPTION TEXT POS CENTRAL
OPTION IMAGE POS CENTRAL
OPTION SPRITE POS CENTRAL
maxx=screen_width()
maxy=screen_height()
draw font name "Palatino"
if FILE_EXISTS ("System/Рекорд"&SYSTEM_LANGUAGE$ ()&".jpg")=0 then
imj$="System/Рекордen"&".jpg"
else
imj$="System/Рекорд"&SYSTEM_LANGUAGE$ ()&".jpg"
endif
if FILE_EXISTS ("System/Счет"&SYSTEM_LANGUAGE$ ()&".jpg")=0 then
imj1$="System/Счет"&".jpg"
else
imj1$="System/Счет"&SYSTEM_LANGUAGE$ ()&".jpg"
endif
for i=1 to 7
sprite i/10 load "System/"&i&".png"
next i
sprite 102 load "System/Глаза/10.png"
sprite 100 load "System/Клетка.png"
draw image "System/Заставка.jpg" at maxx/2,maxy/2
100 for i=1 to 7
sprite i/10 at -100,maxy/2+200
sprite i/10 delay .004
sprite i/10 da 2 dx 1
sprite i/10 loop
sprite i/10 show
pause .35
next i
goto nach
200 for i=1 to 7
sprite i/10 at maxx+100,maxy/2-200
sprite i/10 delay .004
sprite i/10 da -2 dx -1
sprite i/10 loop
sprite i/10 show
pause .35
next i
nach:
get touch 0 as x,y
if x>-1 then goto 1
if sprite_hit ("0.1",maxx+100,maxy/2+200) then goto 200
if sprite_hit ("0.1",-100,maxy/2-200) then goto 100
goto nach
1
refresh off
for i=1 to 7
sprite i/10 hide
draw image "System/"&i&".png" at maxx/2-360+90*i,maxy/2+200
next i
refresh on
pause .2
for i=1 to 7
draw image "System/Глаза/9"&".png" at maxx/2-360+90*i+1,maxy/2+200-5
nows
next i
for i=1 to 7
.gx=maxx/2-360+90*i+1 ! .gy=maxy/2+200
.tr=i
glazaB
draw image "System/Клетка.png" at maxx/2-360+90*i+1,maxy/2+200
klS
next i
if fin=1 then goto 556
dim f(81)
dim mass(9,9)
dim gor(9)
dim ver(9)
dim stoper.mas(9,9)
dim udal.mas(9,9)
for i=1 to 9
gor(i)=maxx/2-374.5+75*i
ver(i)=maxy/2-374.5+75*i
next i
refresh off
mass(1,1)=1
for i=1 to 9
for i1=1 to 9
If i=1 and i1=1 then 2
If i>1 and i1=1 then mass(i,i1)=mass(i-1,9)+1 else mass(i,i1)=mass(i,i1-1)+1
2
sprite mass(i,i1) begin 75,75
fill rect 75/2,75/2 size 75/2
sprite end
sprite mass(i,i1) at gor(i1),ver(i)
sprite mass(i,i1) alpha 0
sprite mass(i,i1) show
next i1
next i
sprite 101 load "System/Шкала.png"
sprite 101 at maxx-87,maxy/2
refresh on
556 shadow offset 0,0
shadow blur 20
shadow alpha 1
shadow on
refresh off
draw image "System/Игра.jpg" at maxx/2,maxy/2
draw image "System/Поле.jpg" at maxx/2,maxy/2
shadow off
udal.score$="0"
record
sprite 101 show
refresh on
REM НАЧАЛО
for i=1 to 9
for i1=1 to 9
tox(i)=0 ! toy(i)=0 ! sh(i)=0
mass(i,i1)=0
next i1
next i
schet=0
try.nol=0
udal.score=0
for i=1 to 3
.sh(i)=rnd(7)
if .sh(i)=0 then .sh(i)=7
next i
refresh off
for i=1 to 3
5 go=rnd(9)
if go=0 then go=9
ve=rnd(9)
if ve=0 then ve=9
if .mass(ve,go)>0 then 5 else .mass(ve,go)=.sh(i)
refresh off
draw image "System/"&.sh(i)&".png" at .gor(go),.ver(ve)
refresh on
nowS
.gx=go ! .gy=ve
glaza
next i
schet=3
try
REM ГЛАВНЫЙ ЦИКЛ. ВЫБОР ШАРА ДЛЯ ПЕРЕНОСА
loop:
if schet>80 then ! treki ! pause 2 ! gosub finish ! endif
get touch 0 as x,y
gl=rnd(81)
if gl=0 then gl=81
for i=1 to 81
if i=gl then ! .mor=i ! morg ! endif
i$=i
if sprite_hit(i$,x,y) then proverka
next i
goto loop
gosub finish:
finish:
fin=1
refresh off
sprite 101 hide
draw image "System/Заставка.jpg" at maxx/2,maxy/2
refresh on
goto 100
loo:
get touch 0 as x,y
goto loo
REM РОЗЫГРЫШ НОВЫХ ШАРОВ. ПОЯВЛЯЮТСЯ НА БОКОВОЙ ПАНЕЛИ И В УМЕНЬШЕНОМ РАЗМЕРЕ НА ПОЛЕ.
def try
if .schet>80 then return
for i=1 to 3
if nol=0 then
.sh(i)=rnd(7)
if .sh(i)=0 then .sh(i)=7
else
.sh(i)=.sh1(i)
endif
.sh1(i)=rnd(7)
if .sh1(i)=0 then .sh1(i)=7
refresh off
draw image "System/"&.sh1(i)&".png" at (.maxx/2-374.5+37.5)/2,.maxy/2-200+100*i
refresh on
next i
nol=1
m=81-.schet
if m>3 then m=3
for i=1 to m
5 go=rnd(9)
if go=0 then go=9
ve=rnd(9)
if ve=0 then ve=9
if .mass(ve,go)>0 then
goto 5
else
.tox(i)=go ! .toy(i)=ve
draw image "System/"&.sh(i)&".png" at .gor(go),.ver(ve) scale .5
.mass(.toy(i),.tox(i))=.5
endif
next i
end def
REM ПРОВЕРКА НАЛИЧИЯ ШАРА. ВЫБРАННЫЙ ШАР ВЫДЕЛЯЕТСЯ КЛЕТКОЙ
def proverka
GET SPRITE .i POS X,Y
for i=1 to 9
for i1=1 to 9
if .gor(i1)=x and .ver(i)=y and .mass(i,i1)>.5 then ! .tr=.mass(i,i1) ! .gx=x ! .gy=y ! glazaB ! sprite 100 at x,y ! sprite 100 show ! klS ! .stx=i1 ! .sty=i ! kas ! vybor ! return ! endif
next i1
next i
end def
REM ПРОВЕРКА НА НАЛИЧИЕ ПРЕПЯТСТВИЙ
def stoper
GET SPRITE vybor.i POS X,Y
for i=1 to 9
for i1=1 to 9
if i1=.stx and i=.sty then ! n=1 ! stoper.mas(i,i1)=n ! continue ! endif
if .gor(i1)=x and .ver(i)=y then ! if .mass(i,i1)>.5 then ! st=1 ! return ! else ! stoper.mas(i,i1)=1000 ! continue ! endif ! endif
stoper.mas(i,i1)=0
if .mass(i,i1)>.5 then stoper.mas(i,i1)=-1
next i1
next i
for vol=1 to 81
for i=1 to 9
for i1=1 to 9
if stoper.mas(i,i1)=vol then
if i-1>0 then ! if stoper.mas(i-1,i1)=1000 then goto 10 ! if stoper.mas(i-1,i1)=0 then ! n+=1 ! stoper.mas(i-1,i1)=n ! endif ! endif
if i1+1<10 then ! if stoper.mas(i,i1+1)=1000 then goto 10 ! if stoper.mas(i,i1+1)=0 then ! n+=1 ! stoper.mas(i,i1+1)=n ! endif ! endif
if i+1<10 then ! if stoper.mas(i+1,i1)=1000 then goto 10 ! if stoper.mas(i+1,i1)=0 then ! n+=1 ! stoper.mas(i+1,i1)=n ! endif ! endif
if i1-1>0 then ! if stoper.mas(i,i1-1)=1000 then goto 10 ! if stoper.mas(i,i1-1)=0 then ! n+=1 ! stoper.mas(i,i1-1)=n ! endif ! endif
endif
next i1
next i
next vol
st=1
return
10 nn=1000
.f(1)=1000
for kk=2 to 81
.f(kk)=0
next kk
for kk=2 to 81
for i=1 to 9
for i1=1 to 9
if stoper.mas(i,i1)=nn then
if stoper.mas(i,i1)=1 then 15
for k=1 to 4
if k=1 then ! a=i1+1 ! b=i ! endif
if k=2 then ! a=i1 ! b=i+1 ! endif
if k=3 then ! a=i1-1 ! b=i ! endif
if k=4 then ! a=i1 ! b=i-1 ! endif
if a>0 and b>0 and a<10 and b<10 then! if stoper.mas(b,a)<nn and stoper.mas(b,a)>0 then nn=stoper.mas(b,a) ! .f(kk)=nn ! endif
next k
continue kk
endif
next i1
next i
next kk
15 beg
proverka1
end def
REM ВЫБОР МЕСТА УСТАНОВКИ ШАРА
def vybor
5 get touch 0 as x,y
gl=rnd(81)
if gl=0 then gl=81
for i=1 to 81
if i=gl then ! .mor=i ! morg ! endif
i$=i
if sprite_hit(i$,x,y) then ! palS ! kas ! if i=.i then ! sprite 100 hide ! return ! endif ! stoper ! if stoper.st=1 then ! stoper.st=0 ! kl=0 ! stoS ! sprite 100 hide ! return ! endif ! if proverka1.kl=1 then ! proverka1.kl=0 ! goto 5 ! else ! return ! endif ! endif
next i
goto 5
end def
REM ПРОВЕРКА ВЫБРАННОГО МЕСТА
def proverka1
GET SPRITE vybor.i POS X,Y
for i=1 to 9
for i1=1 to 9
if .gor(i1)=x and .ver(i)=y and .mass(i,i1)<1 then ! kas ! if .mass(i,i1)=.5 then ! .mass(i,i1)=.mass(proverka.i,proverka.i1) ! .mass(proverka.i,proverka.i1)=0 ! perenos ! else ! .mass(i,i1)=.mass(proverka.i,proverka.i1) ! .mass(proverka.i,proverka.i1)=0 ! endif ! udal ! hod ! if udal.ud=1 then ! udal.ud=0 ! return ! endif ! try ! return ! endif
next i1
next i
kl=1
end def
REM УВЕЛИЧЕНИЕ
def hod
ochistka
if udal.ud=1 then 10
for i=1 to 3
if .tox(i)>0 then
if .mass(.toy(i),.tox(i))=.5 then
refresh off
draw image "System/"&.sh(i)&".png" at .gor(.tox(i)),.ver(.toy(i))
.schet+=1
refresh on
nowS
.gx=.tox(i) ! .gy=.toy(i)
glaza
.mass(.toy(i),.tox(i))=.sh(i)
endif
endif
next i
UDAL
if udal.ud=0 then 10
ochistka
10 .sh(i)=0 ! .tox(i)=0 ! .toy(i)=0
vybor.kl=0
end def
REM ОЧИСТКА ЭКРАНА
def ochistka
refresh off
draw image "System/Поле.jpg" at .maxx/2,.maxy/2
for i=1 to 9
for i1=1 to 9
if i=.sty and i1=.stx then continue
if .mass(i,i1)>.5 then
draw image "System/"&.mass(i,i1)&".png" at .gor(i1),.ver(i)
.gx=i1 ! .gy=i
glaza
endif
next i1
next i
for i=1 to 3
if .mass(.toy(i),.tox(i))=.5 then
draw image "System/"&.sh(i)&".png" at .gor(.tox(i)),.ver(.toy(i)) scale .5
endif
next i
refresh on
end def
def perenos
for i=1 to 3
if .tox(i)=proverka1.i1 and .toy(i)=proverka1.i then
5 go=rnd(9)
if go=0 then go=9
ve=rnd(9)
if ve=0 then ve=9
if .mass(ve,go)>0 then
goto 5
else
.tox(i)=go ! .toy(i)=ve
.mass(.toy(i),.tox(i))=.5
endif
endif
next i
end def
def glaza
gl=rnd(9)
if gl=0 then gl=9
draw image "System/Глаза/"&gl&".png" at .gor(.gx)+1,.ver(.gy)-5
end def
def glazaB
sprite 102 at .gx,.gy scale .7
sprite 102 show
glS
sprite 102 hide
end def
def morg
get sprite .mor pos posx,posy
for i=1 to 9
for i1=1 to 9
if .gor(i1)=posx and .ver(i)=posy then
if .mass(i,i1)>.5 then
.gx=i1 ! .gy=i ! glaza
endif
endif
next i1
next i
end def
def kas
loop:
get touch 0 as x,y
if x=-1 then return
goto loop
end def
def udal
for i=1 to 9
for i1=1 to 9
mas(i,i1)=0
next i1
next i
for i=1 to 9
for i1=1 to 5
if .mass(i,i1)=.mass(i,i1+1) and .mass(i,i1)=.mass(i,i1+2) and .mass(i,i1)=.mass(i,i1+3) and .mass(i,i1)=.mass(i,i1+4) and .mass(i,i1)>.5 then
mas(i,i1)=-5
mas(i,i1+1)=-5
mas(i,i1+2)=-5
mas(i,i1+3)=-5
mas(i,i1+4)=-5
ud=1
endif
next i1
next i
for i=1 to 5
for i1=1 to 9
if .mass(i,i1)=.mass(i+1,i1) and .mass(i,i1)=.mass(i+2,i1) and .mass(i,i1)=.mass(i+3,i1) and .mass(i,i1)=.mass(i+4,i1) and .mass(i,i1)>.5 then
mas(i,i1)=-5
mas(i+1,i1)=-5
mas(i+2,i1)=-5
mas(i+3,i1)=-5
mas(i+4,i1)=-5
ud=1
endif
next i1
next i
for i=1 to 5
for i1=1 to 5
if .mass(i,i1)=.mass(i+1,i1+1) and .mass(i,i1)=.mass(i+2,i1+2) and .mass(i,i1)=.mass(i+3,i1+3) and .mass(i,i1)=.mass(i+4,i1+4) and .mass(i,i1)>.5 then
mas(i,i1)=-5
mas(i+1,i1+1)=-5
mas(i+2,i1+2)=-5
mas(i+3,i1+3)=-5
mas(i+4,i1+4)=-5
ud=1
endif
next i1
next i
for ii=1 to 5
i=10-ii
for i1=1 to 5
if .mass(i,i1)=.mass(i-1,i1+1) and .mass(i,i1)=.mass(i-2,i1+2) and .mass(i,i1)=.mass(i-3,i1+3) and .mass(i,i1)=.mass(i-4,i1+4) and .mass(i,i1)>.5 then
mas(i,i1)=-5
mas(i-1,i1+1)=-5
mas(i-2,i1+2)=-5
mas(i-3,i1+3)=-5
mas(i-4,i1+4)=-5
ud=1
endif
next i1
next ii
if ud=0 then return
.na=0
ochistka
for i=1 to 9
for i1=1 to 9
if mas(i,i1)=-5 then
.tr=.mass(i,i1)
.schet-=1
sprite 100 at .gor(i1),.ver(i)
sprite 100 stamp
.gx=.gor(i1) ! .gy=.ver(i)
glazaB
.vyp=1
.gx=i1 ! .gy=i
glaza
.mass(i,i1)=0
.na+=1
napS
endif
next i1
next i
.vyp=0
if .na=5 then score+=5 else score+=5+2^(.na-5)
if score>val(record.scor$) then
FILE "System/Score" trim 0
FILE "System/Score" print score
FILE "System/Score" setpos 0
endif
score$=score
record
fill color 1,0,0
h=250/val(record.scor$)*score
refresh off
if score<val(record.scor$) then
fill rect .maxx-87,.maxy/2+250-h size 20,h
else
fill rect .maxx-87,.maxy/2+250-250 size 20,250
endif
refresh on
scS
end def
def record
refresh off
draw color 0,0,0
FILE "System/Score" READLINE scor$
FILE "System/Score" setpos 0
draw image .imj$ at .maxx-87,47
draw text scor$ at .maxx-87,60
draw color 1,1,1
draw image .imj1$ at .maxx-87,.maxy-47
draw text udal.score$ at .maxx-87,.maxy-35
refresh on
end def
def beg
sprite 100 hide
for k=1 to 81
kk=82-k
if .f(kk)=0 then continue
for i=1 to 9
for i1=1 to 9
if .f(kk)=1 and stoper.mas(i,i1)=.f(kk) then ! anx=i1 ! any=i ! continue ! endif
if stoper.mas(i,i1)=.f(kk) then
if i1=anx then
if i>any then ! angle=180 ! any=i ! goto 10 ! endif
if i<any then ! angle=0 ! any=i ! goto 10 ! endif
endif
if i=any then
if i1>anx then ! angle=90 ! anx=i1 ! goto 10 ! endif
if i1<anx then ! angle=270 ! anx=i1 ! goto 10 ! endif
endif
10 draw image "System/Бег.png" at .gor(i1),.ver(i) angle angle
begS
continue k
endif
next i1
next i
next k
end def
REM МИДИ заставки
def treki
notes load "System/Trek1.mid"
notes play
end def
REM ЗВУК КЛЕТКИ
def klS
notes set "9:i(c5g5b5)"
notes play
pause .2
end def
REM ЗВУК ПОЯВЛЕНИЯ
def nowS
notes set "78:sc"
notes play
pause .2
end def
REM ЗВУК Выбора позиции
def palS
notes set "108:ic"
notes play
pause .2
end def
REM ЗВУК УДИВЛЕНИЯ
def glS
if .tr=1 then notes set "123:tcrc"
if .tr=2 then notes set "123:tdrd"
if .tr=3 then notes set "123:tere"
if .tr=4 then notes set "123:tfrf"
if .tr=5 then notes set "123:tgrg"
if .tr=6 then notes set "123:tara"
if .tr=7 then notes set "123:tbrb"
notes play
pause .2
end def
REM ЗВУК при наличии препятствия
def stoS
notes set "112:icc"
notes play
pause .3
end def
REM ЗВУК добавления очков
def scS
notes set "98:qe","srigsg"
notes play
pause .3
end def
REM ЗВУК Бег
def begS
notes set "12:tba6"
notes play
pause .05
end def
REM ЗВУК НАПОЛНЕНИЯ
def napS
if .na=1 then notes set "13:ic3"
if .na=2 then notes set "13:id3"
if .na=3 then notes set "13:ie3"
if .na=4 then notes set "13:if3"
if .na=5 then notes set "13:ig3"
if .na=6 then notes set "13:ia3"
if .na=7 then notes set "13:ib3"
if .na=8 then notes set "13:ic"
if .na=9 then notes set "13:id"
if .na=10 then notes set "13:ie"
if .na=11 then notes set "13:if"
if .na=12 then notes set "13:ig"
if .na=13 then notes set "13:ia"
if .na=14 then notes set "13:ib"
if .na>14 then notes set "13:ic5"
notes play
pause .1
end def