***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=0 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 140 buNum=20:dim buX[buNum],buY[buNum],buSt[buNum] :'bullet 150 for i=0 to buNum-1:buX[i]=0:buY[i]=0:buSt[i]=NONE:next:prevA=0 160 BuCount=0 300 gosub 1200 : ' 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 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 a=rand() 1050 'if (i/3)*3=i then a=rand() else a=255-rand() 1055 b=rand() 1060 'if (i/2)*2=i then b=rand() else b=255-rand() 1070 put a*BgWidth/255,b*BgHight/255,bm1,set,F,fm1 1080 ' next 1090 ' for i=0 to 300 1100 'if (i/2)*2=i then a=rand() else a=255-rand() 1105 a=rand() 1110 'if (i/3)*3=i then b=rand() else b=255-rand() 1115 b=rand() 1120 put a*BgWidth/255,b*BgHight/255,bm1,set,F,fm2 1130 next 1150 return 1200 '--------- define Char ------------------ 1205 MyWidth=10:MyHight=5:MyHGap=3 1210 MyChar=createBM(MyWidth,MyHight) 1220 setBM MyChar,0,"0001111000" 1230 setBM MyChar,1,"0011001100" 1235 setBM MyChar,2,"0110000110" 1240 setBM MyChar,3,"1111111111" 1250 setBM MyChar,4,"1111001111" 1300 MyCharMask=createBM(MyWidth+2,MyHight+2) 1310 setBM MyCharMask,0,"111100001111" 1320 setBM MyCharMask,1,"111000000111" 1330 setBM MyCharMask,2,"110000000011" 1335 setBM MyCharMask,3,"100000000001" 1340 setBM MyCharMask,4,"000000000000" 1350 setBM MyCharMask,5,"000000000000" 1360 setBM MyCharMask,6,"000000000000" 1370 MyBu1W=2:MyBu1H=3 1380 MyBu1=createBM(MyBu1W,MyBu1H) 1390 setBM MyBu1,0,"11" 1400 setBM MyBu1,1,"11" 1410 setBM MyBu1,2,"11" 1800 return 1900 '--------- define Sound ------------------ 1910 Shoot="T600L64G8A8L64." 1990 return 2000 '--------- show background ------------------ 2010 if BgY1+ScHight-120 then lCount=10 2330 if R=1 then rCount=rCount+1 else rCount=0 2335 if rCount>20 then rCount=10 2340 if U=1 then uCount=uCount+1 else uCount=0 2345 if uCount>20 then uCount=10 2350 if D=1 then dCount=dCount+1 else dCount=0 2355 if dCount>20 then dCount=20 2360 if L=1 then MyX=MyX-(1+lCount/4) 2370 if R=1 then MyX=MyX+(1+rCount/4) 2380 if U=1 then MyY=MyY-(1+uCount/4) 2390 if D=1 then MyY=MyY+(1+dCount/4) 2400 if MyXScHight-MyHGap then MyY=ScHight-MyHight-MyHGap 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:BuCount=BuCount+1:if BuCount>MyBu1H then BuCount=MyBu1H+1 2990 return 3000 '----------- shoot ----------- 3005 if BuCount>MyBu1H then 3010 sound 2,Shoot:play 2 3020 for i=0 to buNum-1 3030 if buSt[i]=NONE then 3040 buSt[i]=EXIST:buX[i]=MyX+MyWidth/2-MyBu1W/2 3042 buY[i]=MyY-MyBu1H:BuCount=0 3045 exit for 3050 end if 3060 next 3070 end if 3080 return 3200 '----------- move bullet ------------- 3210 for i=0 to buNum-1 3220 if buSt[i]=EXIST then 3230 if buY[i]<>0 then 3240 buY[i]=buY[i]-1 3250 put buX[i],buY[i],MyBu1,or,F 3260 else 3270 buSt[i]=NONE 3280 end if 3290 end if 3300 next 3310 return 5000 '=============== STAGE =============== 5010 count=0:cls 5020 MyX=BarWidth+BgWidth/2-MyWidth/2 5030 MyY=ScHight-MyHight-MyHGap 5040 scAreaX=BarWidth*2+BgWidth 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<10 5230 gosub 2000 : ' show background 5235 '---------- move background --------------- 5240 BgY1=BgY1-BgSpeed1:BgY2=BgY2-BgSpeed2 5250 if BgY1<0 then BgY1=BgY1+BgHight:count=count+1 5260 if BgY2<0 then BgY2=BgY2+BgHight 5270 gosub 2300 : ' move My Char 5280 gosub 3200 : ' move bullet 5450 update BarWidth,0,BarWidth+BgWidth-1,ScHight-1 5460 if sound1status()=0 then play 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 10590 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 ***program end***