历经N天的努力,基于BBasic平台的游戏Beats产生了!
dimk,ctr,mok,mot,penx,peny,ctr,n,s1,s2,s3,s4,i1,hard,time,count,i2 dimmstar,mfree,mhard,mchoose1,mchoose2,chopic1,chopic2,count,mcou dim grow,exc,aver,mpage hard=10 time=0'-----loadres---- chopic1=loadres("Beats\beats.lib",1) chopic2=loadres("Beats\beats.lib",2) homepic=loadres("Beats\beats.lib",3) iconpic=loadres("Beats\beats.lib",4) helppic=loadres("Beats\beats.lib",5) pagepic=loadres("Beats\beats.lib",6) scorepic=loadres("Beats\beats.lib",7) ,--------read sav------- open "Beats\beats.sav" for binaryas #1 get #1,mstar get #1,mfree get #1,mhard get #1,count get #1,grow get #1,exc get #1,aver get #1,mpage if lof(1)=0 then mhard=1 mstar=0 mfree=0 count=20 grow=0 aver=0 exc=0 mpage=0 end if close #1 '----- ctr=0 i1=0 mot=0 n=5 showpic(-1,homepic,0,0,240,320,0,0,1) while n>0 if keypress(key_enter) then ifmstar=0 then goto 004 else goto 001 endif else if keypress(key_escape) then end end if wend '------主页------- 004 cls showpic(-1,iconpic,0,0,240,100,0,0,1) font(font_16hei) pixlocate(88,128) print"开始游戏" pixlocate(88,160) print"帮助说明" pixlocate(88,192) print"游戏设置" pixlocate(88,224) print"退出游戏" k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if penx>=88 and penx<=152 then ifpeny>=128 and peny<=144 then goto 001 else if peny>=160 and peny<=176 then goto 005 else if peny>=192 and peny<=208 then goto 009 else if peny>=224 and peny<=240 then end else goto 004 endif else goto 004 end if '--------帮助------- 005 k=0 penx=0 peny=0 cls showpic(-1,helppic,0,0,240,320,0,0,1) pixlocate(0,220) font(font_12hei) print"由于BBasic限制,无法加载音乐,使用本软件" print"时请先启动音乐。" print"" print"版本:" print"Ver 3.3" print"Beats:音乐节奏类游戏" font(font_16hei) pixlocate(0,304) print"返回" k=0 penx=0 peny=0 k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if penx>=0 and penx<=32 then ifpeny>=304 and peny<=320 then goto 004 end if else cls goto 005 end if'-------change------- 009 cls font(font_16hei) print print"Beats" pixlocate(20,50) print"快速启动" font(font_12hei) pixlocate(20,72) print"取消开始菜单。" font(font_16hei) pixlocate(20,104) print"自由模式" font(font_12hei) pixlocate(20,126) print"取消Beats数量限制。" font(font_16hei) pixlocate(0,145) print"困难程度" pixlocate(20,170) print"容易" pixlocate(20,190) print"中等" pixlocate(20,210) print"使用边框" pixlocate(0,240) print"Beats数量设置" pixlocate(200,294) print"返回" if mstar=0 then showpic(-1,chopic1,0,45,20,20,0,0,1) else if mstar=1 then showpic(-1,chopic2,0,45,20,20,0,0,1) end if if mfree=0 then showpic(-1,chopic1,0,99,20,20,0,0,1) else if mfree=1 then showpic(-1,chopic2,0,99,20,20,0,0,1) end if if mhard=1 then showpic(-1,chopic2,0,165,20,20,0,0,1) showpic(-1,chopic1,0,185,20,20,0,0,1) else if mhard=2 then showpic(-1,chopic1,0,165,20,20,0,0,1) showpic(-1,chopic2,0,185,20,20,0,0,1) end if if mpage=0 then showpic(-1,chopic2,0,205,20,20,0,0,1) else if mpage=1 then showpic(-1,chopic1,0,205,20,20,0,0,1) end if k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if penx>=0 and penx<=20 then ifpeny>=45 and peny<=65 then if mstar=0 then mstar=1 showpic(-1,chopic2,0,45,20,20,0,0,1) cls goto 009 else if mstar=1 then mstar=0 showpic(-1,chopic1,0,45,20,20,0,0,1) cls goto 009 end if else if peny>=110 and peny<=130 then ifmfree=0 then mfree=1 showpic(-1,chopic2,0,99,20,20,0,0,1) cls goto 009 elseif mfree=1 then mfree=0 showpic(-1,chopic1,0,99,20,20,0,0,1) cls goto009 endif elseif peny>=165 and peny<=185 then mhard=1 cls goto009 elseif peny>=185 and peny<=205 then mhard=2 cls goto009 else if peny>=205 and peny<=225 then ifmpage=0 then mpage=1 cls goto 009 else if mpage=1 then mpage=0 cls goto 009 end if else goto 009 endif else if penx>=0 and penx<=96 then ifpeny>=240 and peny<=256 then mcou=1 goto 010 else goto 009 endif else if penx>=0 and penx<=240 then ifpeny>=304 and peny<=320 then i1=0 i2=0 i=0 open "Beats\beats.sav" for binary as #2 put#2,mstar put#2,mfree put#2,mhard put#2,count put#2,grow put#2,exc put#2,aver put#2,mpage close #2 goto 004 else goto 009 endif else goto 009 end if 010 cls if mcou=1 then font(font_16hei) print"Beats数量设置" print"当前Beats数量"+count font(font_16hei) pixlocate(0,296) print"清除" pixlocate(64,296) print"+50" pixlocate(120,296) print"+100" pixlocate(192,296) print"完成" k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if peny>=296 and peny<=320 then ifpenx>=0 and penx<=48 then count=0 cls goto 010 else if penx>=64 and penx<=100 then count=count+50 cls goto 010 else if penx>=120 and penx<=150 then count=count+100 cls goto 010 else if penx>=192 and penx<=240 then cls mcou=0 goto 009 else cls goto 010 endif else cls goto 010 end if end if 001 cls k=0 penx=0 peny=0 ctr=rnd(900) if ctr>=0 and ctr<100 then mok=1 else if ctr>=100 and ctr<200 then mok=2 else if ctr>=200 and ctr<=300 then mok=3 else if ctr>=300 and ctr<400 then mok=4 else if ctr>=400 and ctr<500 then mok=5 else if ctr>=500 and ctr<600 then mok=6 else if ctr>=600 and ctr<700 then mok=7 else if ctr>=700 and ctr<800 then mok=8 else if ctr>=800 and ctr<900 then mok=9 end if '------屏幕显示----- 002 if mpage=0 then showpic(-1,pagepic,0,0,240,240,0,0,1) else if mpage=1 then goto 012 end if 012 if mok=1 then fillpage(-1,0,0,80,80,&hff0000) else if mok=2 then fillpage(-1,80,0,80,80,&h00ffff) else if mok=3 then fillpage(-1,160,0,80,80,&h0000ff) else if mok=4 then fillpage(-1,0,80,80,80,&h00ffff) else if mok=5 then fillpage(-1,80,80,80,80,&h00ff00) else if mok=6 then fillpage(-1,160,80,80,80,&h0000ff) else if mok=7 then fillpage(-1,0,160,80,80,&hffffff) else if mok=8 then fillpage(-1,80,160,80,80,&h00ffff) else if mok=9 then fillpage(-1,160,160,80,80,&h00ff00) end if if mfree=0 then fillpage(-1,0,290,i2,6,&hffffff) font(font_12hei) pixlocate(0,275) print"进度:"+i1+"/"+count else if mfree=1 then font(font_12hei) pixlocate(0,285) print"自由模式" end if font(font_16hei) pixlocate(0,304) print"返回" '-------触点坐标------- k=0 penx=0 peny=0 011 k=waitkey() penx=getpenposx(k) peny=getpenposy(k) if peny>=0 and peny<80 then ifpenx>=0 and penx<80 then mot=1 goto 003 else if penx>=80 and penx<160 then mot=2 goto 003 else if penx>=160 and penx<240 then mot=3 goto 003 end if else if peny>=80 and peny<160 then ifpenx>=0 and penx<80 then mot=4 goto 003 else if penx>=80 and penx<160 then mot=5 goto 003 else if penx>=160 and penx<240 then mot=6 goto 003 end if else if peny>=160 and peny<240 then ifpenx>=0 and penx<80 then mot=7 goto 003 else if penx>=80 and penx<160 then mot=8 goto 003 else if penx>=160 and penx<240 then mot=9 goto 003 end if else if peny>=304 and peny<=320 then if penx>=0 and penx<=32 then if mfree=0 then i=0 i1=0 i2=0 goto 004 else if mfree=1 then showpic(-1,scorepic,0,0,240,240,0,0,1) font(font_12hei) grow=grow+i exc=exc+1 pixlocate(0,80) print"自由模式" print"" print"本次游戏共进行"+i1+"个Beats。" print"Beats"+i+"个。" print"" print"增加成就值:"+i+"分。" print"" print"-----------------------------------------" print"信息" print"-----------------------------------------" print"" print"共进行游戏"+exc+"次。" print"成就值共"+grow+"分。" print"" aver=grow/exc print"平均成就值"+aver+"分。" i=0 i1=0 i2=0 waitkey() cls goto 004 end if end if end if '------判断坐标-------- 003 if mfree=0 then i2=240/count*i1 fillpage(-1,0,290,i2,6,&hffffff) if mok=mot then i=i+1 i1=i1+1 mot=0 cls if i1=count then goto 007 else goto001 end if else cls mot=0 i1=i1+1 goto 001 end if else if mfree=1 then ifmot=mok then i=i+1 i1=i1+1 mot=0 cls goto 001 else i1=i1+1 mot=0 cls goto 001 endif end if 007 cls font(font_12hei) showpic(-1,scorepic,0,0,240,240,0,0,1) grow=grow+i exc=exc+1 pixlocate(0,80) print"共"+count+"个Beats。" print"" print"Beats"+i+"个。" print"增加成就值"+i+"分。" print"" print"---------------------------------------------" print"信息" print"---------------------------------------------" print"" print"共进行游戏"+exc+"次。" print"成就值共"+grow+"分。" aver=grow/exc print print"平均成就值"+aver+"分。" i1=0 i=0 i2=0 waitkey() goto 004 end if运行结果:
@ Mayuko