Loop:'★★★ループの始まりの標識(メインルーチン)★★★
If OnGame=1 Then 'ゲームに入っているなら…
OnGame=2 'フラグを2に変更
GraphicsWindow.Clear() '画面消去
GraphicsWindow.FontSize=48 'フォントサイズを48にする
GraphicsWindow.BrushColor="Blue" '色をブルーにする
GraphicsWindow.DrawText(gw/2-160,gh/2-70,"Game Start!") '「Game Start!」表示
Sound.PlayBellRingAndWait() 'ベルリングを鳴らして一旦ストップ
Goto Top 'トップへ
EndIf
'
'ラケットゲームの処理↓
x=x+deltaX
y=y+deltaY
'
If tenjyou>=gh-gh/4 Then '天井が下まで来たら…
Sound.PlayChimeAndWait()
Program.Delay(100) 'Net用時間調整!!!!!!!!!!!!!!!!!
Goto Hajimari
EndIf
'
If(x>gw-16 Or x<=0) Then 'ボールが横の壁に当たったら…
deltaX=-deltaX
EndIf
If(y<=tenjyou) Then 'ボールが天井を越えたら…
deltaY=-deltaY
EndIf
'
rakettoX=Shapes.GetLeft(rwing) 'ラケットの位置を取得
If(y>=gh-22 And y<=gh-20 And x>=rakettoX-18 And x<=rakettoX+52) Then 'ボールがラケットに当たったら…
deltaY=-deltaY
tenjyouRakka()
'
score=score+bairitu*kihonten
ScoreKaunto()
Sound.PlayClick()
EndIf
'
Shapes.Move(ball,x,y) 'ボールを動かす
'
If(y>=gh) Then 'ボールが画面の底(下)を越えたら…
GameOverGamen() 'ゲームオーバー
Goto Top '最初からゲームを始める
EndIf
'
'1.インボーダーの動作↓
'
If ix>=gw Then'…もしインボーダーがウィンドウの幅を超えたら…
IchijiTokuten=-500 '500点減点
score=score+IchijiTokuten
IchijiTokutenHyouji()
If score<0 Then
score=0 '0点以下にならないようにする
EndIf
ScoreKaunto()
'
ix=0'…インボーダーのX座標を0にする(最初に戻る)
iMissyleShokika() 'インボーダーのミサイル初期化サブへ飛ぶ
EndIf
'
ix=ix+Idx'…インボーダーのX座標をIdx分増やす(インボーダーのスピード調整)
InvoderMove()'…インボーダーを動かすサブに飛ぶ
'
If ix>=iMissyleX0 Then 'もしインボーダーのX座標がiMissyleX0を超えたら以下を処理
If iMissyleY>=gh-40 And iMissyleX>=rokettoX-25 And iMissyleX<=rokettoX+25 Then 'もしインボーダーのミサイルが自機に当たったら…
RokettoBakuhatu() '自機の爆発サブに飛ぶ
kitaisuu=kitaisuu-1 '自機数を1減らす
ScoreKaunto() 'スコアー表示サブへ
If Kitaisuu=0 Then '自機数が0なら…
GameOverGamen() 'ゲームオーバー
Else
iMissyleX=ix 'インボーダーミサイルのX座標をインボーダーのX座標とする
iMissyleY=0 'インボーダーミサイルのY座標を0(画面の一番上)にする
Goto Loop
EndIf
Goto Top 'トップに戻る
EndIf
If iMissyleY>=gh Then 'もしインボーダーのミサイルのY座標が画面の縦幅を超えたら
iMissyleX=ix 'インボーダーミサイルのX座標をインボーダーのX座標とする
iMissyleY=0 'インボーダーミサイルのY座標を0(画面の一番上)にする
EndIf
'
Shapes.Move(iMissyle,iMissyleX,iMissyleY) 'インボーダーミサイルを座標(iMissylex,iMissyleY)に移動する
iMissyleY=iMissyleY+iMdy 'インボーダーミサイルのY座標の値を増やす(ミサイルが下がる)
Endif
'
'2.自機の動作↓
'
If MissileFlag=1 Then '自機ミサイルが飛行中なら以下の処理
If MyMissileY<=15 And MyMissileX>=ix-20 And MyMissileX<=ix+20 Then 'もしミサイルのY座標が15以下で、X座標がインボーダーの機体範囲内なら以下を処理する
InvoderBakuhatu() 'インボーダー爆発サブへ飛ぶ
score=score+IchijiTokuten 'ボーナス得点
ibkaunto=ibkaunto+1 'インボーダー撃墜数を1増やす
If MyMissileY<=0 then 'もし自機ミサイルのY座標が15以下になら以下の処理
MissileFlag=0 '自機ミサイル飛行終了とする
MyMissileY=gh '自機ミサイルのY座標をウィンドウの一番下にする
EndIf
Shapes.Move(MyMissile,MyMissileX-5,MyMissileY) '自機ミサイルを座標(MyMissileX,MyMissileY)に移動
MyMissileY=MyMissileY-MMdy '自機ミサイルのY座標からMMdyを引く(ミサイルが前進する)
Goto Loop 'Loopの最初に戻る
EndIf
If Mouse.IsLeftButtonDown Then 'もしマウスの左ボタンが押されたら以下の処理
MissileFlag=1 'ミサイル飛行中宣言
MyMissileX=GraphicsWindow.MouseX '自機ミサイルのX座標をマウスのX座標とする
EndIf
'
Goto Loop'…ループの最初へ
'
'
'-------------------- サブルーチン ↓ -------------------------------
'
Sub OnMouseMove'…マウスに動きがあった時のサブ
rokettoX=GraphicsWindow.MouseX'…マウスの位置(X座標)
Shapes.Move(rtop,rokettoX-7,gh-40)'…ロケットの先端を動かす
Shapes.Move(rwing,rokettoX-24,gh-22)'…ロケット翼を動かす
Shapes.Move(rbody,rokettoX-10,gh-25)'…ロケットのボディを動かす
Shapes.Move(rpit,rokettoX-3,gh-19)'…ロケットのコックピットを動かす
EndSub
'
Sub UchuuHyouji '…宇宙表示サブ
For i=1 To 100 ' …100回繰り返す(100この星)
hx=Math.GetRandomNumber(gw)'…星のX座標(乱数)
hy=Math.GetRandomNumber(gh)'…星のY座標(乱数)
GraphicsWindow.SetPixel(hx,hy,"White")'…座標(hx,hy)のピクセルを白にする
EndFor
For i=1 To 50 '50この星
hx=Math.GetRandomNumber(gw)'…星のX座標(乱数)
hy=Math.GetRandomNumber(gh)'…星のY座標(乱数)
GraphicsWindow.SetPixel(hx,hy,"LightSalmon")'…座標(hx,hy)のピクセルを白にする
EndFor
For i=1 To 50 '50この星
hx=Math.GetRandomNumber(gw)'…星のX座標(乱数)
hy=Math.GetRandomNumber(gh)'…星のY座標(乱数)
GraphicsWindow.SetPixel(hx,hy,"LightBlue")'…座標(hx,hy)のピクセルを白にする
EndFor
For i=1 To 30 '30この星
hx=Math.GetRandomNumber(gw)'…星のX座標(乱数)
hy=Math.GetRandomNumber(gh)'…星のY座標(乱数)
GraphicsWindow.SetPixel(hx,hy,"Yellow")'…座標(hx,hy)のピクセルを白にする
EndFor
EndSub
'
Sub InvoderMove'…インボーダーの動きサブ
Shapes.Move(iwing,ix-20,0)'…インボーダーの翼を動かす
Shapes.Move(ibody,ix-15,0)'…インボーダーのボディを動かす
Shapes.Move(itop,ix-4,9)'…インボーダーの先端を動かす
EndSub
'
Sub InvoderBakuhatu 'インボーダーの爆発表示サブ
Shapes.Move(ibakuhatu1,ix-35+i,-20) '爆発用の円1を描く
Shapes.Move(ibakuhatu2,ix-15+i,-20) '爆発用の円2を描く
Shapes.Move(ibakuhatu3,ix-25+i,-10) '爆発用の円3を描く
IchijiTokuten=100
IchijiTokutenHyouji()
Shapes.Move(ibakuhatu1,ix-35,-50) '発爆用の円1消去(ウドンィウ外へ)
Shapes.Move(ibakuhatu2,ix-15,-50) '発爆用の円2消去(ウドンィウ外へ)
Shapes.Move(ibakuhatu3,ix-25,-50) '発爆用の円3消去(ウドンィウ外へ)
EndSub
'
Sub MymissyleShokika '自機ミサイル初期化サブ
MissileFlag=0 'ミサイル飛行フラグを降ろす(飛んでいない状態とする)
MyMissileY=gh '自機ミサイルのY座標をウィンドウの一番下にする
Shapes.Move(MyMissile,MyMissileX,MyMissileY) '画面から消す
EndSub
'
Sub iMissyleShokika 'インボーダーミサイル初期化サブ
iMissyleX0=Math.GetRandomNumber(gw/4) 'ミサイル発射のX座標をランダムに決める(画面の1/4以下)
iMissyleX=iMissyleX0 'ミサイルの位置(X座標)をiMissyleX0とする
iMissyleY=0 'Y座標を0とする
Shapes.Move(iMissyle,iMissyleX,iMissyleY-50) '画面の外に放り出す
EndSub
'
Sub RokettoBakuhatu '自機ロケットの爆発表示サブ
Shapes.Move(ibakuhatu1,rokettoX-35,gh-35) '爆発用の円1を描く
Shapes.Move(ibakuhatu2,rokettoX-15,gh-35) '爆発用の円2を描く
Shapes.Move(ibakuhatu3,rokettoX-25,gh-25) '爆発用の円3を描く
'
Sound.PlayChimesAndWait() 'チャイムを鳴らし、鳴り終わるまで待つ
Program.Delay(1000) '待ち時間を作る
Shapes.Move(ibakuhatu1,rokettoX-35,gh+50) '発爆用の円1消去(ウドンィウ外へ)
Shapes.Move(ibakuhatu2,rokettoX-15,gh+50) '発爆用の円2消去(ウドンィウ外へ)
Shapes.Move(ibakuhatu3,rokettoX-25,gh+50) '発爆用の円3消去(ウドンィウ外へ)
EndSub
'
Sub ScoreKaunto 'スコアーを表示するサブ
GraphicsWindow.FontSize=15
GraphicsWindow.BrushColor="Black"
GraphicsWindow.FillRectangle(gw-220,gh-50,200,20)
GraphicsWindow.FillRectangle(gw-150,gh-25,150,20)
GraphicsWindow.BrushColor="Red"
GraphicsWindow.DrawText(gw-220,gh-50,"Score:"+score)
GraphicsWindow.BrushColor="Orange"
GraphicsWindow.DrawText(gw-120,gh-50,"Hi-score:"+hiscore)
'
'インボーダーの撃墜数チェック↓
If ibkaunto=10 Then 'インボーダーを10機打ち落としたら
kitaisuu=kitaisuu+1 '自機数を1増やす
Sound.PlayBellRing() 'ベルリングを鳴らす
ibkaunto=0 '撃墜数を0にリセット
EndIf
'もし撃墜数が10を越えたら自機数1機増加↓
GraphicsWindow.BrushColor="#00bb00" '緑
If kitaisuu=1 Then
GraphicsWindow.DrawText(gw-150,gh-25,"▲")
ElseIf kitaisuu=2 then
GraphicsWindow.DrawText(gw-150,gh-25,"▲▲")
ElseIf kitaisuu=3 then
GraphicsWindow.DrawText(gw-150,gh-25,"▲▲▲")
ElseIf kitaisuu=4 then
GraphicsWindow.DrawText(gw-150,gh-25,"▲▲▲▲")
ElseIf kitaisuu=5 then
GraphicsWindow.DrawText(gw-150,gh-25,"▲▲▲▲▲")
ElseIf kitaisuu=6 then
GraphicsWindow.DrawText(gw-150,gh-25,"▲▲▲▲▲▲")
ElseIf kitaisuu=7 then
GraphicsWindow.DrawText(gw-150,gh-25,"▲▲▲▲▲▲▲")
ElseIf kitaisuu>=8 then
GraphicsWindow.DrawText(gw-150,gh-25,"▲▲▲▲▲▲▲+")
EndIf
EndSub
'
Sub TenjyouRakka 'ボールの跳ね返る天井表示サブ
GraphicsWindow.PenColor="Black"
GraphicsWindow.DrawLine(0,tenjyou,gw,tenjyou)
GraphicsWindow.PenColor="#111150"
tenjyou=tenjyou+tenjyouatumi
GraphicsWindow.DrawLine(0,tenjyou,gw,tenjyou)
EndSub
'
Sub GameOverGamen 'ゲームオーバー画面
GraphicsWindow.Clear()
GraphicsWindow.FontSize=20
GraphicsWindow.BrushColor="Orange"
If score>hiscore Then 'もしハイスコアーなら
hiscore=score '現在スコアーをハイスコアーに
GraphicsWindow.DrawText(10,10,"Wow!! You got hiscore!!!")
EndIf
GraphicsWindow.BrushColor="HotPink"
GraphicsWindow.DrawText(50,40,"Game Over!")
GraphicsWindow.BrushColor="GreenYellow"
GraphicsWindow.DrawText(gw/2-40,60,"Your Score:"+score)
GraphicsWindow.BrushColor="White"
GraphicsWindow.DrawText(gw/2-30,90,"Hi-Score:"+hiscore)
GraphicsWindow.FontSize=20
If score<1000 Then
Sound.PlayChimesAndWait()
GraphicsWindow.DrawText(gw/2-150,gh/2+20,"You are Baby!!! 赤ちゃん!")
ElseIf score<2000 And score>=1000 Then
Sound.PlayChimesAndWait()
GraphicsWindow.DrawText(gw/2-150,gh/2+20,"You are Beginner!!! ビギナー!")
ElseIf score<3000 And score>=2000 Then
Sound.PlayBellRingAndWait()
GraphicsWindow.DrawText(gw/2-150,gh/2+20,"Good! But,You are Amateur!!! アマチュア!")
ElseIf score<4000 And score>=3000 Then
Sound.PlayBellRingAndWait()
GraphicsWindow.DrawText(gw/2-150,gh/2+20,"Wow! Wonderful!!! すげぇ!")
ElseIf score<5000 And score>=4000 Then
Sound.PlayChimesAndWait()
GraphicsWindow.DrawText(gw/2-150,gh/2+20,"You are Professional!!! プロだぁ!")
ElseIf score<6000 And score>=5000 Then
Sound.PlayChimesAndWait()
GraphicsWindow.DrawText(gw/2-150,gh/2+20,"Maybe,You are Genius!!! 天才!")
ElseIf score>=6000 Then
Sound.PlayChimesAndWait()
GraphicsWindow.DrawText(gw/2-150,gh/2+20,"Unbelievable! You must be God! 神様だぁ!")
Endif
'
Program.Delay(4000)
OnGame=0
'
EndSub
'
Sub IchijiTokutenHyouji '一時的に得点を表示して消すサブ
If IchijiTokuten<0 Then '減点の場合
GraphicsWindow.BrushColor="Red"
GraphicsWindow.DrawText(gw/2-30,gh/2-10,IchijiTokuten)
Sound.PlayChimesAndWait()
Program.Delay(100) 'Net用調整時間!!!!!!!!!!!!!!!!!!!!!!!!!!!
Else 'ボーナス得点
GraphicsWindow.BrushColor="YellowGreen"
GraphicsWindow.DrawText(gw/2-30,gh/2-10,"+"+IchijiTokuten)
Sound.PlayChimeAndWait()
'Program.Delay(100) 'Net用調整時間!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
EndIf
GraphicsWindow.BrushColor="Black" '色を黒に
GraphicsWindow.FillRectangle(gw/2-30,gh/2-10,50,20) '消去
EndSub
'
Sub GameStart '何かキーを押された場合の処理
If OnGame=0 Then 'ゲームにまだ入ってないなら
OnGame=1 'ゲーム中にする(フラグを1に)
EndIf
EndSub
'
Sub TopGamen 'トップページ表示サブ
GraphicsWindow.FontSize=48
GraphicsWindow.BrushColor="Blue"
GraphicsWindow.DrawText(gw/2-167,gh/2-77,"陰謀ダーゲーム")
GraphicsWindow.BrushColor="CadetBlue"
GraphicsWindow.DrawText(gw/2-170,gh/2-80,"陰謀ダーゲーム")
GraphicsWindow.BrushColor="Gold"
GraphicsWindow.FontSize=20
GraphicsWindow.DrawText(gw/2-110,gh/2+20,"Push anykey to start")
GraphicsWindow.BrushColor="White"
GraphicsWindow.FontSize=15
GraphicsWindow.DrawText(gw/2-70,gh/2+70,"(C) iZo Arts Japan") '←ジョークです
EndSub