昔、ベーマガに投稿したゲームです。
▲1〜2人で遊べます。1人のときはコンピュータと対戦します。
▲上下で剣の位置を3段階に動かします。
ジョイスティックのボタンを押すと、剣を前に出します。そのままだと防御です。
▲体力がなくなるか、台から落ちると終了です。
▲実行直後の初期化画面。16x16ドットのキャラを2倍に引き伸ばしてスプライトに登録してます。
題名:「剣豪」
転載元:電波新聞社 「マイコンBASICマガジン」1992年3月号
対応機種:X68000(X-BASIC)
10 /*------------- kengou for X68k-------------------------------------*/ 20 /* (Original) Micom BASIC Magazine 1992/3 by takuya matsubara */ 30 screen 0,1,1,1:sp_disp(1):sp_off(0,127):vpage(1) 40 str v[64] 50 int a,i,j,r,w,z,u,mode 60 dim x(1),t(1),x1(1),h(1),q(1) 70 fill(0,220,255,255,2) 80 fill(50,166,200,255,4) 90 for i=0 to 50:pset(rnd()*255,rnd()*120,12+rnd()*4):next 100 symbol(80,35,"剣豪",2,2,2,10,0) 110 sp():sp_color(14,&HF0F0,1):sp_color(14,&HFF0,2) 120 music() 130 while 1 140 cls :/* m_play(5) */ 150 locate 11,5:print "K E N G O":locate 6,7:print "Hit Trigger Button" 160 locate 2,12:print "joy1trg : JOY1 VS COMPUTER" 170 locate 2,13:print "joy2trg : JOY1 VS JOY2" 180 repeat:j=strig(1):i=strig(2):until i+j:cls 190 if j then mode=1 else mode=0 200 print "1 PLAYER ";:if mode=0 then print "2 PLAYER" else print "X68000" 210 for i=0 to 1 220 x(i)=80+i*94:x1(i)=sgn(120-x(i)):h(i)=3:q(i)=10 230 fill(i*155,16,i*155+100,32,i*2+3) 240 next 250 w=1:z=150 260 /*----------- main -----------------------------------*/ 270 while w 280 for i=0 to 1:j=abs(i-1) 290 a=stick(1+i):if h(i)=3 then { 300 u=(a=4)*6-(a=6)*6-int(i*mode*rnd()*1.2#)*6:x(i)=x(i)+u 310 if abs(x(i)-x(j))<28 then x(i)=x(i)-u 320 t(i)=-(a=2)*8-(a=8)*16 330 if mode*i=1 then t(i)=-(rnd()>0.5#)*8-(rnd()>0.5#)*8 340 if strig(1+i)=1 or int(mode*rnd()*i*1.2#)>0 then h(i)=-2:t(i)=t(i)+4: /*m_play(2)*/ 350 } else x(i)=x(i)-sgn(h(i)*x1(i))*8:h(i)=h(i)+1 360 set() 370 if h(i)=0 then { 380 if abs(x(i)-x(j))<16 then { 390 if abs(t(i)-t(j))<5 then { 400 /* m_play(1) */ 410 }else { 420 /* m_play(3) */ 430 x(j)=x(j)-x1(j)*10:q(j)=q(j)-1:fill(j*155+100,16,j*155+q(j)*10,32,0) 440 } 450 } 460 } 470 if point(x(i),230)=2 or q(i)=0 then w=0:break 480 next 490 endwhile 500 m_play(4):for z=150 to 240:set():next 510 locate 3,5:print j+1;"PLAYER WlN!" 520 /*repeat:until m_stat(4)=0*/ 530 endwhile 540 end 550 /*-------------------sub ------------------------------------*/ 560 func set() 570 if i=0 then { sp_set(0,x(0) ,z ,&H100+t(0),3) 580 sp_set(1,x(0)+16,z ,&H101+t(0),3) 590 sp_set(2,x(0) ,z+16,&H102+t(0),3) 600 sp_set(3,x(0)+16,z+16,&H103+t(0),3) 610 }else{ 620 sp_set(4,x(1)+16,z ,&H4200+t(1),3) 630 sp_set(5,x(1) ,z ,&H4201+t(1),3) 640 sp_set(6,x(1)+16,z+16,&H4202+t(1),3) 650 sp_set(7,x(1) ,z+16,&H4203+t(1),3) 660 } 670 endfunc 680 func sp() 690 /*----------0-----*/ 700 v="08001c001E009c0088009D00FDF03F001E0008001c0016001200320022007380" 710 def2(0) 720 /*----------1-----*/ 730 v="04000E009F008E0084004E103FFF1E100E0004000E000B001100220026003300" 740 def2(4) 750 /*----------2-----*/ 760 v="00000000000000000E000F000E0074009E00BF80B1F894801B00048009001B80" 770 def2(8) 780 /*----------3-----*/ 790 v="00000000000000000E000F000E00E400BE009F90BDFF38102E00130024007E00" 800 def2(12) 810 /*----------4-----*/ 820 v="08001D001BF01B0006001E003c005c009c0088009c0017001200340022007000" 830 def2(16) 840 /*----------5-----*/ 850 v="04000E100E7F0c9003000F001E002E004E0044002F0009800900138020007000" 860 def2(20) 870 endfunc 880 /*-------------def---------------------------*/ 890 func def2(a):dim char p(255) 900 for i=0 to 15:r=32768:w=val("&h"+mid$(v,i*4+1,4)) 910 for j=0 to 15:if w>=r then w=w-r:z=14 else z=0 920 fill(j*2,i*2,j*2+1,i*2+1,z) 930 r=r/2:next:next 940 for r=0 to 3:for i=0 to 15:for j=0 to 15 950 p(i*16+j)=point(j+(r mod 2)*16,i+(r\2)*16):next:next 960 sp_def(a+r,p,1):locate 0,7:print "sprite setting(";a+r;"/ 23 )":next 970 fill(0,0,31,31,0) 980 endfunc 990 /*------------music----------------------------------------------*/ 1000 func music() 1010 /* m_alloc(1,99):m_alloc(2,99):m_alloc(3,99):m_alloc(4,99):m_alloc(5,99) */ 1020 /* m_assign(1,1):m_assign(2,2):m_assign(3,3):m_assign(4,4):m_assign(5,5) */ 1030 /* v="v15@67o6b20":m_trk(1,v) */ 1040 /* v="v15@66o4e50":m_trk(2,v) */ 1050 /* v="v15@66o4e20":m_trk(3,v) */ 1060 /* v="v15@2o4acd30f10d5edfd6a20d30e1":m_trk(4,v) */ 1070 /* v="v15@4o4a9d9e9f9go5c9f9g5b9o6d1":m_trk(5,v) */ 1080 endfunc
オリジナルと若干修正しています。
・見づらいところを直しています。
・「B“o”tton」のスペルミスを修正。毎回、これやってます。
・パレットの初期化命令「sp_color」を追加しています。オリジナルではパレットの初期化をやっていなかったんですが、、、なぜか色が出ていたようです。
・フリー版のHuman68kにOPMDRVがついてこないらしいので、サウンド関連の命令(m_playなど)を注釈にしています。
EDU mk1への移植版はこちら
http://d.hatena.ne.jp/nicotakuya/20091209/1260378781