***program start*** 10 '=========== SHOOTING ============= 20 GameTitle="SHOOTING" 30 ScWidth=128:ScHight=64 40 FontWidth=6:FontHight=8:BarWidth=3 50 ScoreStr="SCORE":HiScoreStr="HISCO":StageStr="STAGE" 60 BgWidth=ScWidth-strlen(ScoreStr)*FontWidth-BarWidth*2-1 70 BgHight=ScHight*2 80 Fm1=createFM(BgWidth,BgHight) 90 Fm2=createFM(BgWidth,BgHight):gosub 1000: 'draw background 100 Score=0:Stage=1 110 HighScoreNum=ScHight/FontHight-3 120 dim HighScore[HighScoreNum]:gosub 9060 130 if (keyA()<>1)||(keyB()<>1) then gosub 8100 : 'read HighScore 135 NONE=0:EXIST=1:ST1=1:ST2=2:ST3=3:EXPLOSION=4 140 BuMax=20:dim BuX[BuMax],BuY[BuMax],BuSt[BuMax] :'bullet 150 for I=0 to BuMax-1:BuX[I]=0:BuY[I]=0:BuSt[I]=NONE:next:PrevA=0 170 EnMapNum=200:dim EnIn[EnMapNum],EnPr[EnMapNum] 190 EnMax=20:dim EnSt[EnMax],EnX[EnMax],EnY[EnMax],EnType[EnMax] 200 dim EnP1[EnMax],EnP2[EnMax],EnP3[EnMax],EnCo[EnMax] 300 gosub 20000 : ' define Char 310 gosub 1900 : ' define Sound 320 gosub 10000 : ' Demo 350 gosub 5000 : ' temp stage 400 '=========== Main Routine ============= 410 'while -1 420 ' gosub 10000 :' Demo 430 ' while -1 440 ' gosub 1000 :' Stage 450 ' if GameOver=1 then gosub 11000:exit while 460 ' if GameClear=1 then gosub 12000 470 ' end while 480 'end while 500 end 900 '--------- init EnTable -------------------- 905 for I=0 to EnMapNum-1:EnIn[I]=100000:next 910 for I=0 to EnMax-1:EnSt[I]=NONE:next 930 return 1000 '--------- draw background ------------------ 1010 Bm1=createBM(1,1) 1020 setBM Bm1,0,"1" 1030 cls F,Fm1:cls F,Fm2 1040 for I=0 to 300 1045 X=rand() 1055 Y=rand() 1070 put X*BgWidth/255,Y*BgHight/255,Bm1,set,F,Fm1 1105 X=rand() 1115 Y=rand() 1120 put X*BgWidth/255,Y*BgHight/255,Bm1,set,F,Fm2 1130 next 1150 return 1900 '--------- define Sound ------------------ 1910 Shoot="T600L64G8A8L64." 1990 return 2000 '--------- show background ------------------ 2010 if BgY1+ScHight-110 then LCount=10 2327 else 2328 LCount=0 2329 end if 2330 if R=1 then 2332 MyX=MyX+(1+RCount/4) 2333 if BarWidth+BgWidth10 then RCount=10 2337 else 2338 RCount=0 2339 end if 2340 if U=1 then 2342 MyY=MyY-(1+UCount/4):if MyY10 then UCount=10 2347 else 2348 UCount=0 2349 end if 2350 if D=1 then 2352 MyY=MyY+(1+DCount/4) 2353 if MyY+MyHight>ScHight-MyHGap then MyY=ScHight-MyHight-MyHGap 2355 DCount=DCount+1:if DCount>10 then DCount=10 2357 else 2358 DCount=0 2359 end if 2440 put MyX-1,MyY-1,MyCharMask,and,F 2450 put MyX,MyY,MyChar,or,F 2460 if PrevA=0 then 2470 if A=1 then gosub 3000 : 'shoot 2480 end if 2490 PrevA=A 2990 return 3000 '----------- shoot ----------- 3010 sound 2,Shoot:play 2 3020 for I=0 to BuMax-1 3030 if BuSt[I]=NONE then 3040 BuSt[I]=EXIST:BuX[I]=MyX+MyWidth/2-MyBu1W/2 3042 BuY[I]=MyY-MyBu1H 3045 exit for 3050 end if 3060 next 3080 return 3200 '----------- move bullet ------------- 3210 gosubM BuSt[],I,EXIST,3250 3220 return 3250 if BuY[I]>3 then 3260 BuY[I]=BuY[I]-3 3270 put BuX[I],BuY[I],MyBu1,or,F 3280 else 3290 BuSt[I]=NONE 3300 end if 3310 return 5000 '=============== STAGE =============== 5010 Count=1:cls: gosub 900 :' init Entable 5020 MyX=BarWidth+BgWidth/2-MyWidth/2 5030 MyY=ScHight-MyHight-MyHGap 5040 ScAreaX=BarWidth*2+BgWidth 5050 gosub 50000:' load map 5060 LCount=0:RCount=0:UCount=0:DCount=0 5070 MapIdx=0 5130 Y=0:GameClear=0:GameOver=0 5140 putStr ScAreaX,Y,StageStr,1 : Y=Y+FontHight : StageY=Y 5150 gosub 6020 : Y=Y+FontHight : 'Disp Stage 5160 putStr ScAreaX,Y,HiScoreStr,1 : Y=Y+FontHight : HiScoreY=Y 5170 gosub 6040 : Y=Y+FontHight : 'Disp HiScore 5180 putStr ScAreaX,Y,ScoreStr,1 : Y=Y+FontHight : ScoreY=Y 5190 gosub 6080 : Y=Y+FontHight : 'Disp Score 5200 BgY1=0:BgY2=0:BgSpeed1=1:BgSpeed2=2 5205 TEMPO="T500V10":sound 1,TEMPO+S11+S12+S13+S11+S12+S15 5206 play 1 5210 while Count<500 5230 gosub 2000 : ' show background 5235 '---------- move background --------------- 5240 BgY1=BgY1-BgSpeed1:BgY2=BgY2-BgSpeed2 5250 if BgY1<0 then BgY1=BgY1+BgHight 5260 if BgY2<0 then BgY2=BgY2+BgHight 5270 gosub 2300 : ' move My Char 5280 gosub 3200 : ' move bullet 5290 gosub 30000 : ' move enemy 5450 update BarWidth,0,BarWidth+BgWidth-1,ScHight-1 5460 if sound1status()=0 then play 1 5490 Count=Count+1 5500 end while 5510 return 6000 '----- STAGE Sub ----- 6010 'Disp Stage 6020 putStr ScAreaX,StageY,format("%-5D",Stage),1 6030 return 6040 'Disp HighScore 6050 gosub 9000 6060 putStr ScAreaX,HiScoreY,format("%-5D",HiScore),1 6070 return 6080 'Disp Score 6090 putStr ScAreaX,ScoreY,format("%-5D",Score),1 6100 return 8000 '-------- saveHiscore ------------ 8010 Addr=0 8020 write Addr,GameTitle:Addr=Addr+16 8030 for I=0 to HighScoreNum-1 8040 write Addr,format("%D",HighScore[I]):Addr=Addr+16 8050 next 8060 return 8100 '-------- readHiscore ------------ 8110 Addr=0 8120 if GameTitle=read(Addr,strlen(GameTitle)) then 8125 Addr=Addr+16 8130 for I=0 to HighScoreNum-1 8140 HighScore[I]=val(read(Addr,5)):Addr=Addr+16 8150 next 8160 end if 8170 return 9000 '---------get HiScore------------- 9010 HiScore=0:MinHiScore=100000 9020 for I=0 to HighScoreNum-1 9030 if HighScore[I]>HiScore then HiScore=HighScore[I] 9035 if MinHiScore>HighScore[I] then MinHiScore=HighScore[I] 9040 next 9050 return 9060 '--------HiScore Initial---------- 9070 for I=0 to HighScoreNum-1 9080 HighScore[I]=0 9090 next 9095 return 10000 '-------------- openning --------------------- 10003 ' music:maoudamasii(maou_bgm_piano29) 10005 TEMPO="T400" 10010 S111="L16HD#6L32.L16HD#6L32.L16HD#6L32." 10011 S112="L16HE6L32.L16HE6L32.L16HE6L32." 10012 S113="L16HF#6L32.L16HF#6L32.L16HF#6L32.L16HF#6L32." 10013 S114="L16HE6L32.L16HE6L32.L16HE6L32." 10014 S115="L16HD#6L32.L16HD#6L32.L16HE6L32.L16HE6L32." 10015 S116="L16HD#6L32.L16HD#6L32.L16HD#6L32." 10016 S117="L16HE6L32.L16HE6L32.L16HE6L32." 10017 S118="L16HF#6L32.L16HF#6L32.L16HF#6L32.L16HF#6L32." 10018 S11=S111+S112+S113+S114+S115+S116+S117+S118 10040 ' 10050 S121="L16HE6L32.L16HE6L32.L16HE6L32." 10051 S122="L16HD#6L32.L16HD#6L32.L16HE6L32.L16HE6L32." 10052 S123="L16HD#6L32.L16HD#6L32.L16HD#6L32." 10053 S124="L16HE6L32.L16HE6L32.L16HE6L32." 10054 S125="L16HF#6L32.L16HF#6L32.L16HF#6L32.L16HF#6L32." 10055 S126="L16HE6L32.L16HE6L32.L16HE6L32." 10056 S127="L16HD#6L32.L16HD#6L32.L16HD#6L32." 10057 S12=S121+S122+S123+S124+S125+S126 10080 ' 10090 S131="L16HE6L32.L16HE6L32.L16HD#6L32." 10091 S132="L16HE6L32.L16HD#6L32.L4G#5_L1._" 10097 S13=S127+S131+S132 10120 ' 10160 ' 10173 S154="L16HD#6L32.L16HD#6L32.L16HE6L32." 10174 S155="L16HD#6L32.L16HE6L32.L16HD#6L32." 10175 S156="L16HC#6L32.L16HC#6L32.L4._L1._" 10176 S15=S154+S155+S156 10200 ' 10300 sound 1,TEMPO+S11+S12+S13+S11+S12+S15 10310 play 1 10400 '----- MAKE SCREEN ------- 10410 cls 10430 Comment="PUSH B KEY" 10440 TitleX=(ScWidth-strlen(GameTitle)*FontWidth)/2 10450 TitleY=(ScHight-2*FontWidth)/3 10460 putStr TitleX,TitleY,GameTitle,1 10470 CommentX=(ScWidth-strlen(Comment)*FontWidth)/2 10480 putStr CommentX,TitleY*2,Comment,1 10490 '--------------- Wait --------------- 10495 keyBpushd=0 10500 while -1 10505 for I=0 to 20 10507 if keyB()=1 then keyBpushd=1:exit for 10510 if sound1status()=0 then play 1 10520 sleep 50 10525 next 10530 putStr CommentX,TitleY*2,Comment,1,xor,T 10535 if keyBpushd=1 then exit while 10550 end while 10560 sound 1,"L8." 10570 'sound 2,"L8." 10580 'sound 3,"L8." 10590 play1:'play 1,2,3 10600 return 20000 '=========== define Char ============= 20005 MyWidth=10:MyHight=5:MyHGap=3 20010 MyChar=createBM(MyWidth,MyHight) 20020 setBM MyChar,0,"0001111000" 20030 setBM MyChar,1,"0011001100" 20035 setBM MyChar,2,"0110000110" 20040 setBM MyChar,3,"1111111111" 20050 setBM MyChar,4,"1111001111" 20100 MyCharMask=createBM(MyWidth+2,MyHight+2) 20110 setBM MyCharMask,0,"111100001111" 20120 setBM MyCharMask,1,"111000000111" 20130 setBM MyCharMask,2,"110000000011" 20135 setBM MyCharMask,3,"100000000001" 20140 setBM MyCharMask,4,"000000000000" 20150 setBM MyCharMask,5,"000000000000" 20160 setBM MyCharMask,6,"000000000000" 20170 MyBu1W=2:MyBu1H=3 20180 MyBu1=createBM(MyBu1W,MyBu1H) 20190 setBM MyBu1,0,"11" 20200 setBM MyBu1,1,"11" 20210 setBM MyBu1,2,"11" 20300 En0W=8:En0H=5 20310 Enemy00=createBM(En0W,En0H) 20320 setBM Enemy00,0,"00011000" 20330 setBM Enemy00,1,"01111110" 20350 setBM Enemy00,2,"11111111" 20370 setBM Enemy00,3,"01111110" 20390 setBM Enemy00,4,"00011000" 25000 return 30000 '=========== move enemy =========== 30100 '-------- load Map to EnTable ------------ 30110 for I=MapIdx to EnMapNum-1 30120 if EnIn[I]=Count then 30130 gosub 50800:' load Map to EnTable 30135 MapIdx=I+1 30140 else 30150 if EnIn[I]>Count then exit for 30160 end if 30170 next 30180 '---------- move ------------ 30190 'Num=EnNum 30200 'for I=0 to EnMax-1 30205 ' if Num=0 then exit for 30210 ' if EnSt[I]=EXIST then 30220 ' if EnType[I]=1 then 30230 ' gosub 40000:' Enemy 1 30240 ' 'EnCo[I]=EnCo[I]+1 30500 ' end if 30510 ' Num=Num-1 30520 ' end if 30530 'next 30610 gosubM EnSt,I,ST1,40000,ST2,43000,ST3,46000 35000 return 40000 '---------- Pat 1 ------------ 40010 EnCount=Count-EnCo[I] 40020 gosubC EnType[I],40100 40030 return 40100 '--- EnemyType0 Pat1 ---- 40110 EnY[I]=EnY[I]+2 40120 put EnX[I],EnY[I],Enemy00,or,F 40130 if EnCount>=EnP1[I] then EnSt[I]=ST2 40140 return 43000 '---------- Pat 2 ------------ 43010 EnCount=Count-EnCo[I] 43020 gosubC EnType[I],43100 43030 return 43100 '--- EnemyType0 Pat2 ---- 43120 put EnX[I],EnY[I],Enemy00,or,F 43130 if EnCount>=EnP2[I] then EnSt[I]=ST3 43140 return 46000 '---------- Pat 3 ------------ 46010 EnCount=Count-EnCo[I] 46020 gosubC EnType[I],46100 46030 return 46100 '--- EnemyType0 Pat3 ---- 46110 EnY[I]=EnY[I]-2 46120 put EnX[I],EnY[I],Enemy00,or,F 46130 if EnCount>=EnP3[I] then EnSt[I]=NONE 46140 return 50000 '=========== load map =========== 50010 if Stage=1 then 50020 gosub 51000 50730 else 50740 gosub 51000 50750 end if 50760 return 50800 '---------- load Map to EnTable------- 50805 Found=EnMax 50810 for J=0 to EnMax-1 50820 if EnSt[J]=NONE then 50830 Found=J:exit for 50840 end if 50850 next 50860 if Found<>EnMax then 50870 EnSt[Found]=ST1 50880 ' EnX[Found]=val(mid(EnPr[I],0,3)) 50890 ' EnY[Found]=val(mid(EnPr[I],3,6)) 50900 ' EnType[Found]=val(mid(EnPr[I],6,9)) 50910 ' EnP1[Found]=val(mid(EnPr[I],9,12)) 50920 ' EnP2[Found]=val(mid(EnPr[I],12,15)) 50930 ' EnP3[Found]=val(mid(EnPr[I],15,18)) 50935 strToA EnPr[I],0,Found,3,EnX,3,EnY,3,EnType,3,EnP1,3,EnP2,3,EnP3 50940 EnCo[Found]=EnIn[I] 50960 end if 50970 return 51000 '-----------Stage 1 ------------------- 51020 W1=format("%03D",BgWidth/5-En0W/2):W2=format("%03D",BgWidth*2/5-En0W/2) 51030 W3=format("%03D",BgWidth*3/5-En0W/2):W4=format("%03D",BgWidth*4/5-En0W/2) 51040 W5=format("%03D",BgWidth/2-En0W/2) 51100 '--InTime-------------- x -- y -- type --- pat1 ---pat2 ---pat3 51110 EnIn[0]=ScHight/2:EnPr[0]=W5+"000"+"000"+"010"+"015"+"025" 51120 EnIn[1]=ScHight/2+25:EnPr[1]=W1+"000"+"000"+"010"+"015"+"025" 51130 EnIn[2]=ScHight/2+25:EnPr[2]=W4+"000"+"000"+"010"+"015"+"025" 51140 EnIn[3]=ScHight/2+40:EnPr[3]=W2+"000"+"000"+"010"+"015"+"025" 51150 EnIn[4]=ScHight/2+40:EnPr[4]=W3+"000"+"000"+"010"+"015"+"025" 51160 EnIn[5]=ScHight/2+60:EnPr[5]=W1+"000"+"000"+"010"+"015"+"025" 51170 EnIn[6]=ScHight/2+60:EnPr[6]=W4+"000"+"000"+"010"+"015"+"025" 51180 EnIn[7]=ScHight/2+60:EnPr[7]=W2+"000"+"000"+"010"+"015"+"025" 51190 EnIn[8]=ScHight/2+60:EnPr[8]=W3+"000"+"000"+"010"+"015"+"025" 51210 EnIn[9]=100:EnPr[9]=W5+"000"+"000"+"010"+"015"+"025" 51220 EnIn[10]=125:EnPr[10]=W1+"000"+"000"+"010"+"015"+"025" 51230 EnIn[11]=125:EnPr[11]=W4+"000"+"000"+"010"+"015"+"025" 51240 EnIn[12]=140:EnPr[12]=W2+"000"+"000"+"010"+"015"+"025" 51250 EnIn[13]=140:EnPr[13]=W3+"000"+"000"+"010"+"015"+"025" 51260 EnIn[14]=160:EnPr[14]=W1+"000"+"000"+"010"+"015"+"025" 51270 EnIn[15]=160:EnPr[15]=W4+"000"+"000"+"010"+"015"+"025" 51280 EnIn[16]=160:EnPr[16]=W2+"000"+"000"+"010"+"015"+"025" 51290 EnIn[17]=160:EnPr[17]=W3+"000"+"000"+"010"+"015"+"025" 60000 return ***program end***