500 gosub 20000
550 NAME$="intro.pi1"
600 gosub 30000
650 F$="\treasure\treasure.mod" : gosub 31000
660 repeat 
662 K$=inkey$
663 if K$=chr$(27) then cls : default : track play MT : end 
664 if K$=chr$(67) or K$=chr$(99) then NAME$="credit.pi1" : cls : track play MT : gosub 30000
665 if K$=chr$(71) or K$=chr$(103) then NAME$="control.pi1" : cls : track play MT : gosub 30000
666 if NAME$="credit.pi1" or NAME$="control.pi1" then NAME$=" " : goto 550
667 if K$=" " then goto 679
669 if K$=chr$(49) then GAME=1 : K=0 : goto 679
670 if K$=chr$(50) then GAME=2 : K=1 : gosub 25750 : goto 679
671 if K$=chr$(51) then GAME=3 : K=1 : gosub 25750 : goto 679
672 if K$=chr$(52) then GAME=4 : K=1 : gosub 25750 : goto 679
673 if K$=chr$(53) then GAME=5 : K=1 : gosub 25750 : goto 679
678 until K$=" "
679 fade 10 : wait (10*7)
680 erase (7) : cls
700 F$="\treasure\flasback.mod" : track play MT
710 if GAME=1 and K=0 then gosub 25750 : gosub 25000 : rem start GAME 1
720 if GAME=2 and K=1 then gosub 20400 : gosub 24900 : rem start GAME 2
740 if GAME=3 and K=1 then gosub 20400 : gosub 24800 : rem Start GAME 3
760 if GAME=4 and K=1 then gosub 20400 : gosub 24700 : rem Start GAME 4
780 if GAME=5 and K=1 then gosub 20400 : gosub 24600 : rem Start GAME 5
800 gosub 31000
900 bob 0,0,320,200,0,1
1000 world 0,0,320,192,0,1
1200 D=palt(start(1)) : wait vbl 
1300 logic=back
1400 repeat 
1410 world logic,start(5),start(10),X,Y,0
1420 bob logic,start(1),IMG,X,Y,0
1440 W1=which block(start(10),X,Y+8)
1450 W2=which block(start(10),X+16,Y+8)
1460 W3=which block(start(10),X+8,Y+16)
1470 W4=which block(start(10),X+8,Y)
1480 W5=which block(start(10),X+8,Y+8)
1490 if W3=0 then Y=Y+8 : LP=LP+1 : if LP>5 then E=E-1 : rem bottom of sprite collide space and loose energy
1500 if W5=39 and X=DX1 and Y=DY1 then E2=0 : gosub 17000
1502 if W5=39 and X=DX2 and Y=DY2 then E3=0 : gosub 17000
1504 if W5=39 and X=DX3 and Y=DY3 then E4=0 : gosub 17000
1506 if W5=62 and GAME=1 then K=K+1 : set block start(10),273,32,0 : set block start(10),309,160,61
1508 if W5=62 and GAME=2 then K=K+1 : set block start(10),96,32,0 : set block start(10),304,32,61
1510 if W5=62 and GAME=3 then K=K+1 : set block start(10),289,32,0 : set block start(10),304,128,61
1512 if W5=62 and GAME=4 then K=K+1 : set block start(10),289,32,0 : set block start(10),1,128,61
1514 if W5=62 and GAME=5 then K=K+1 : set block start(10),289,32,0 : set block start(10),8,32,61
1517 if W5=55 then E=E+20 : if E>=100 then E=100 : E1=0 : set block start(10),X+8,Y+8,0 : goto 1520
1518 if SKULL=1 then gosub 16000 : rem SKULL ANIM
1520 if SNAKE=1 then gosub 16200 : rem SNAKE ANIM
1522 if SPIDER=1 then gosub 16400 : rem SPIDER ANIM
1525 gosub 26000 : rem ENERGY
1528 gosub 27000 : rem DOLLAR
1530 gosub 19000 : rem JOYSTICK CONTROL
1550 pen 12 : locate 16,0 : print "Coin:";C
1560 pen 12 : locate 29,0 : print "Energy:";E
1570 pen 12 : locate 0,0 : print "Level:";GAME
1590 if C=3 and K=1 and GAME=1 and X=305 and Y=160 then GAME=2 : goto 670
1600 if C=3 and K=1 and GAME=2 and X=305 and Y=32 then GAME=3 : goto 670
1620 if C=3 and K=1 and GAME=3 and X=305 and Y=128 then GAME=4 : goto 670
1640 if C=3 and K=1 and GAME=4 and X=1 and Y=128 then GAME=5 : goto 670
1660 if C=3 and K=1 and GAME=5 and X=8 and Y=32 then C=0 : K=0 : goto 9600
4950 if E<=0 then goto 29000
5000 rem
8000 screen swap : wait vbl 
9500 until inkey$=chr$(27)
9550 anim off : mouseon : cls : default : track play MT : end 
9600 goto 28000
11100 rem JOYSTICK LEFT
11130 if W1=7 or W1=1 or W1=1 then goto 11180
11140 if W1=0 then goto 11150
11150 X=X-SP : inc IMGL : if IMGL>30 then IMGL=28
11160 IMG=IMGL : BLK=0
11180 return 
11200 rem JOYSTICK RIGHT
11230 if W2=7 or W2=1 or W2=11 or W2=60 then goto 11280 : rem brick and wall detect
11240 if W2=0 then goto 11250
11250 X=X+SP : inc IMGL : if IMGL>=27 then IMGL=25
11260 IMG=IMGL : BLK=0
11280 return 
11300 rem JOYSTICK DOWN
11330 if W3=7 or W3=1 then goto 11380
11340 if W3=6 or W3=0 then goto 11350
11350 Y=Y+SP : inc IMGL : if IMGL>=24 then IMGL=23
11360 IMG=IMGL
11380 return 
11400 rem JOYSTICK up
11420 if W3=0 then goto 11480
11430 if W4=7 or W4=1 then goto 11480
11440 rem if W4=6 or W4=0 then goto 11450
11450 Y=Y-(SP*2) : inc IMGL : if IMGL>=24 then IMGL=23
11460 IMG=IMGL
11480 return 
11500 rem JOYSTICK FIRE
12000 rem
12500 rem
16000 rem ANIMATE ENEMY 1 * SKULL
16010 inc ANML1 : if ANML1>34 then ANML1=31
16020 ANM1=ANML1
16022 gosub 16500
16029 if RNX1>SKLXRIGHT then WAY=1 : AN1X=0 : rem skxleft skull x left limit,  skxright skull x right limit
16030 if RNX1<SKLXLEFT then WAY=2 : AN1X=0
16031 if WAY=1 then inc AN1X : ANM1X=AN1X*2 : RNX1=SKLXRIGHT-ANM1X
16032 if WAY=2 then inc AN1X : ANM1X=AN1X*2 : RNX1=SKLXLEFT+ANM1X
16036 bob logic,start(1),ANM1,RNX1,RNY1,0
16038 AOV=overlap(X,Y,RNX1,RNY1,16,16,16,16)
16039 if AOV then shoot : E=E-1
16050 return 
16200 rem ANIMATE ENEMY 1 * SNAKE ANIMATE
16210 inc ANML2 : if ANML2>SNWMAX then ANML2=SNWMIN
16220 ANM2=ANML2
16222 gosub 16500
16229 if RNX2>SNKXRIGHT then WAY=1 : AN2X=0 : rem spdxleft snake x left limit,  spdxright snake x right limit
16230 if RNX2<SNKXLEFT then WAY=2 : AN2X=0
16231 if WAY=1 then SNWMAX=36 : SNWMIN=35 : inc AN2X : ANM2X=AN2X*2 : RNX2=SNKXRIGHT-ANM2X
16232 if WAY=2 then SNWMAX=38 : SNWMIN=37 : inc AN2X : ANM2X=AN2X*2 : RNX2=SNKXLEFT+ANM2X
16236 bob logic,start(1),ANM2,RNX2,RNY1,0
16238 AOV=overlap(X,Y,RNX2,RNY1,16,16,16,16)
16239 if AOV then boom : E=E-1
16250 return 
16400 rem ANIMATE ENEMY 3 * SPIDER ANIMATE
16410 inc ANML3 : if ANML3>SPDMAX then ANML3=SPDMIN
16420 ANM3=ANML3
16422 gosub 16500
16429 if RNX3>SPDXRIGHT then WAY=1 : AN3X=0 : rem spdxleft sspider x left limit,  spdxright spider x right limit
16430 if RNX3<SPDXLEFT then WAY=2 : AN3X=0
16431 if WAY=1 then SPDMAX=44 : SPDMIN=42 : inc AN3X : ANM3X=AN3X*2 : RNX3=SPDXRIGHT-ANM3X
16432 if WAY=2 then SPDMAX=44 : SPDMIN=42 : inc AN3X : ANM3X=AN3X*2 : RNX3=SPDXLEFT+ANM3X
16436 bob logic,start(1),ANM3,RNX3,RNY1,0
16438 AOX=overlap(X,Y,RNX3,RNY1,16,16,16,16)
16439 if AOX then boom : E=E-1
16450 return 
16490 rem ENEMY SPRITE MOVE COORD.
16500 if GAME=1 then SKLXLEFT=80 : SKLXRIGHT=240 : RNY1=96 : rem SKULL
16510 if GAME=2 then SNKXLEFT=96 : SNKXRIGHT=240 : RNY1=32 : rem snake
16520 if GAME=3 then SPDXLEFT=48 : SPDXRIGHT=272 : RNY1=144 : rem spider
16540 if GAME=4 then SKLXLEFT=64 : SKLXRIGHT=248 : RNY1=160 : rem skull
16560 if GAME=5 then SNKXLEFT=16 : SNKXRIGHT=160 : RNY1=32 : rem snake
16600 return 
17000 rem COLLECTED ITEM
17010 C=C+1 : shoot : rem collected item number
17040 set block start(10),X+8,Y+8,0
17090 return 
17100 rem COLLECTED ENERGY
17110 rem e=e+10
17120 if E>=100 then E=100
17130 set block start(10),X+8,Y+8,0
17190 return 
19000 rem JOYSTICK CONTROL
19020 if jleft then gosub 11100
19030 if jright then gosub 11200
19040 if jdown then gosub 11300
19050 if jup then gosub 11400
19500 return 
20000 rem INIALIZE
20100 key off : hide : curs off : click off : mode 0 : rem update off
20200 erase (1) : erase (5) : erase (6) : erase (7) : erase (8) : erase (10) : erase (14)
20250 reserve as work 14,500000 : reserve as screen 7 : reserve as screen 8
20300 X=1 : Y=16 : SP=4 : C=0 : K=0 : E=100 : GAME=1 : LP=0
20400 IMG=21 : IMGL=22 : BLK=16 : BLKL=20 : ANM=22 : ANML=2
20450 ANM1=34 : ANML1=31 : ANM2=36 : ANML2=35 : ANM3=44 : ANML3=42
20460 AA=1 : WAY=1 : SNWMAX=36 : SNWMIN=35 : SPDMAX=44 : SPDMIN=42
20470 AN1X=0 : ANM1X=0 : ANM1Y=0
20480 AN2X=0 : ANM2X=0 : ANM2Y=0
20490 AN3X=0 : ANM3X=0 : ANM3Y=0
20500 EC=0 : ECT=3
20800 E1=56 : E1T=55 : E2=41 : E2T=39 : E3=41 : E3T=39 : E4=41 : E4T=39 rem Animated sprites
21000 return 
24600 rem GAME 5
24620 erase (10) : SKULL=0 : SNAKE=1 : SPIDER=0
24640 X=304 : Y=128 : K=0 : C=0
24650 DX1=16 : DY1=32 : DX2=32 : DY2=160 : DX3=208 : DY3=64 : rem dollar coord.
24660 if length(10)=0 then load "\treasure\tmap5.mbk",10
24680 return 
24700 rem GAME 4
24720 erase (10) : SKULL=1 : SNAKE=0 : SPIDER=0
24740 X=1 : Y=16 : K=0 : C=0
24750 DX1=13 : DY1=160 : DX2=161 : DY2=16 : DX3=273 : DY3=160 : rem dollar coord.
24760 if length(10)=0 then load "\treasure\tmap4.mbk",10
24780 return 
24800 rem GAME 3
24820 erase (10) : SKULL=0 : SNAKE=0 : SPIDER=1
24840 X=1 : Y=16 : K=0 : C=0
24850 DX1=97 : DY1=80 : DX2=193 : DY2=96 : DX3=193 : DY3=32 : rem dollar coord.
24860 if length(10)=0 then load "\treasure\tmap3.mbk",10
24880 return 
24900 rem GAME 2
24920 erase (10) : SKULL=0 : SNAKE=1 : SPIDER=0
24940 X=1 : Y=16 : K=0 : C=0
24950 DX1=33 : DY1=80 : DX2=177 : DY2=96 : DX3=289 : DY3=80 : rem dollar coord.
24960 if length(10)=0 then load "\treasure\tmap2.mbk",10
24980 return 
25000 rem GAME 1
25020 erase (10) : SKULL=1 : SNAKE=0 : SPIDER=0
25030 DX1=17 : DY1=80 : DX2=289 : DY2=32 : DX3=289 : DY3=80 : rem dollar coord.
25300 if length(10)=0 then load "\treasure\tmap.mbk",10
25400 rem
25500 set block start(10),273,32,62 : synchro 
25600 return 
25700 rem LOAD *.MBK FILES
25750 if length(6)=0 then load "\treasure\tsprt.mbk",6
25760 if length(1)=0 then load "\treasure\tbobs.mbk",1
25770 if length(5)=0 then load "\treasure\twblock.mbk",5
25800 return 
26000 rem ANIMATED ENERGY
26050 if E1=0 then goto 27000
26100 inc E1T : if E1T>56 then E1T=55
26200 E1=E1T
26240 if GAME=1 then AEX=96 : AEY=96
26260 if GAME=2 then AEX=192 : AEY=144
26270 if GAME=3 then AEX=272 : AEY=144
26280 if GAME=4 then AEX=272 : AEY=80
26290 if GAME=5 then AEX=112 : AEY=64
26300 set block start(10),AEX,AEY,E1
26500 return 
27000 rem ANIMATED DOLLAR
27100 if E2=0 then goto 27210
27200 inc E2T : if E2T>41 then E2T=39
27205 E2=E2T
27210 if E3=0 then goto 27230
27220 inc E3T : if E3T>41 then E3T=39
27225 E3=E3T
27230 if E4=0 then goto 27400
27240 inc E4T : if E4T>41 then E4T=39
27245 E4=E4T
27400 if GAME=1 then set block start(10),16,80,E2 : set block start(10),288,32,E3 : set block start(10),288,80,E4
27420 if GAME=2 then set block start(10),32,80,E2 : set block start(10),176,96,E3 : set block start(10),288,80,E4
27440 if GAME=3 then set block start(10),96,80,E2 : set block start(10),192,96,E3 : set block start(10),192,32,E4
27460 if GAME=4 then set block start(10),16,160,E2 : set block start(10),174,16,E3 : set block start(10),272,160,E4
27480 if GAME=5 then set block start(10),16,32,E2 : set block start(10),32,160,E3 : set block start(10),208,64,E4
27500 return 
28000 rem FINISH GAME
28050 track play MT : cls physic : anim off 
28100 load "\treasure\finish.pi1",8 : get palette (8) : rem physic=8
28150 appear 8,15
28200 rem COLOur 1,$700 : colour 8,$770
28300 screen copy 8 to physic
28400 screen copy physic to back
28450 repeat 
28460 FIN$=inkey$
28480 if FIN$=chr$(27) or FIN$=" " then cls : default : end 
28500 until FIN$=chr$(27) or FIN$=" "
28900 rem
29000 rem GAME OVER
29050 track play MT : cls physic : anim off 
29100 load "\treasure\gameover.pi1",8 : get palette (8) : rem physic=8
29300 screen copy 8 to physic
29400 screen copy physic to back
29450 repeat 
29500 F$=inkey$
29600 if F$=chr$(49) then cls : default : goto 500
29700 if F$=chr$(50) then cls : default : end 
29800 until F$=chr$(49) or F$=chr$(50)
29900 end 
30000 rem MAIN SCREEN
30620 load "\treasure\"+NAME$,7 : get palette (7) : rem physic=7
30630 rem appear 7,25
30640 rem COLOur 1,$700 : colour 8,$770
30650 screen copy 7 to physic
30680 wait 200 : return 
31000 rem  INTRO MUSIC
31020 MT=start(14)
31030 rem
31040 bload F$,MT
31050 track play MT
31100 return
2/3		29.04.2021


