10 for i%=0 to 143
11 gelload "a",str$(i%)+".png"
12 spritegel str$(i%),"a"
13 spritemove str$(i%),1000,0
14 next i%

100 xe%=screenwidth(0):ye%=screenheight(0):x%=xe%/2-16:y%=ye%/2-16
110 setcolor 57,60,57:fillrect 0,0,xe%,ye%
111 spritemove "143",xe%/2-85,ye%/2-60

120 ten4$="30":skor%=5

500 sleep 5000:spritemove "143",1000,0



1000 rem dvigenie 4uvaka
1010 if left(0)<>0 then gosub 2000
1011 if right(0)<>0 then gosub 2010
1012 if down(0)<>0 then gosub 2020
1013 if up(0)<>0 then gosub 2030
1014 if fire(0)<>0 then stop


1020 if stop%=0 then gosub 2040
1024 stop%=0

1100 sleep 100:goto 1010



1200 rem dvigenie grunta
1201 if nap4%=4 and xt%>-1 then xt%=-80
1202 if nap4%=2 and xt%<-79 then xt%=0
1203 if nap4%=1 and yt%>-1 then yt%=-80
1204 if nap4%=3 and yt%<-79 then yt%=0

1220 spritemove "109",xt%,yt%
1230 return



1500 REM animacija 4uvaka
1501 wag4%=wag4%+1:IF WAG4%=4 THEN WAG4%=0
1502 if NAP4%=1 THEN n%=val("21")
1503 if NAP4%=2 THEN n%=val("25")
1504 if NAP4%=3 THEN n%=val("29")
1505 if NAP4%=4 THEN n%=val("33")
1510 spritemove ten4$,1000,0
1511 ten4$=str$(n%+wag4%)
1512 SPRITEMOVE ten4$,X%,Y%
1513 stop%=1

1519 gosub 1200:rem dvgenie grunta

1520 return



2000 rem 4uvak vlevo
2001 nap4%=4:xt%=xt%+skor%:gosub 1500:return

2010 rem 4uvak vpravo
2011 nap4%=2:xt%=xt%-skor%:gosub 1500:return

2020 rem 4uvak vniz
2021 nap4%=3:yt%=yt%-skor%:gosub 1500:return

2030 rem 4uvak vverho
2031 nap4%=1:yt%=yt%+skor%:gosub 1500:return

2040 rem 4uvak stop
2041 spritemove ten4$,1000,0
2042 ten4$=str$(36+nap4%)
2043 spritemove ten4$,x%,y%
2044 return
