スポンサードリンク NOMI GAME WINDOWS版のVisualBasicプログラムです。ご参考ください。 '変数宣言 Option Explicit Dim st, pw, nx, ny, dy, bl As Integer Dim a, b, c As Long 'ブロックの配置 Private Sub put_block() For a = 1 To bl nx = Rnd * 4600 + 800 ny = Rnd * (1000 - 1000 * (bl < 20)) + 1250 - 1000 * (bl >= 20) Line (nx, ny)-(nx + 250 + (bl < 10) * 100, ny + 400), QBColor(10), BF Line (nx, 190)-(nx + 250 + (bl < 10) * 100, 190), QBColor(10), BF Next Line (270, 3100)-(520, 3650), QBColor(2), BF Line (270, 190)-(520, 190), QBColor(10), BF Line (6120, 3100)-(6370 + (bl < 10) * 100, 3650), QBColor(13), BF Line (6120, 190)-(6370 + (bl < 10) * 100, 190), QBColor(10), BF c = 0 'クリアできない面を無くす For a = 270 To 6370 Step 10 b = Point(a, 190) If b = QBColor(15) Then c = c + 10 '下式の"C>XXXX"の数字がクリア不可能な間隔 If c > 1700 Then nx = a - c / 2 ny = Rnd * (1000 - 1000 * (bl < 20)) + 1250 - 1000 * (bl >= 20) Line (nx, ny)-(nx + 250 + (bl < 10) * 100, ny + 400), QBColor(10), BF c = 0 End If ElseIf b = QBColor(10) Then c = 0 End If Next Line (270, 190)-(6380, 190), QBColor(15) End Sub 'ノミ表示 Private Sub Nomi() Line (nx, ny)-(nx + 40, ny + 40), QBColor(a), BF End Sub 'コマンドボタン1処理 Private Sub Command1_Click() 'ゲーム画面表示 If st = 0 Then Combo1.Visible = False Label4.Visible = False Cls Line (200, 200)-(6500, 3650), QBColor(15), BF st = 1 If Combo1 = "EASY" Then bl = 25 ElseIf Combo1 = "DIFFICULT" Then: bl = 10 ElseIf Combo1 = "MANIA" Then: bl = 6 Else: bl = 16 End If Timer2.Interval = 150 Command2.Visible = False put_block 'ノミ初期座標 a = 1: nx = 380: ny = 3060: Nomi Command1.Caption = "JUMP" 'パワーゲージ表示オン ElseIf st = 1 Then st = 2: pw = -1 'ゲームオーバー処理 ElseIf st = 5 Then st = 0 Label2.Visible = False Label3.Visible = False Cls Combo1.Visible = True Label4.Visible = True Label1.Visible = True Command2.Visible = True Command1.Caption = "START" End If End Sub 'ジャンプ処理オン1 Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If st = 2 Then Timer2.Interval = 80 st = 3: a = 1: Nomi dy = -(pw + 1) * 20 End If End Sub 'ジャンプ処理オン2 Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If st = 3 Then st = 4 End Sub 'プログラム終了 Private Sub Command2_Click() End End Sub '初期設定 Private Sub Form_Load() Timer1.Interval = 1 Randomize End Sub 'パワーゲージ表示 Private Sub Timer1_Timer() If st = 2 Then pw = pw + 1 If pw > 17 Then pw = 0 Line (2800, 3800)-(6350, 4300), &H8000000F, BF End If Line (pw * 200 + 2800, 3800)-(pw * 200 + 2950, 4300), QBColor(14), BF End If Timer1.Interval = 30 End Sub 'ノミ各種処理 Private Sub Timer2_Timer() 'ノミ点滅 If st = 1 Or st = 2 Then If a = 1 Then a = 12: Nomi ElseIf a = 12 Then a = 1: Nomi End If 'ノミ移動 ElseIf st = 4 Then nx = nx + 60 ny = ny + dy dy = dy + 20 '当たり判定 a = Point(nx, ny + 40) b = Point(nx + 40, ny + 40) If dy > -20 And (a = QBColor(2) Or a = QBColor(10) Or b = QBColor(2) Or b = QBColor(10)) Then Line (2800, 3800)-(6350, 4300), &H8000000F, BF st = 1: a = 1 Timer2.Interval = 150 ElseIf a = QBColor(13) Or b = QBColor(13) Then st = 5 Label3.Visible = True Command1.Caption = "RETURN" End If 'ノミ画面はみ出し判定 If nx > 200 And ny > 200 And nx < 6460 And ny < 3610 Then a = 1: Nomi ElseIf nx > 6459 Or ny > 3609 Then st = 5 Label2.Visible = True Command1.Caption = "RETURN" End If End If End Sub → ホームへ |