打印本文 打印本文 关闭窗口 关闭窗口
俄罗斯方块的VB实现,部分代码!
作者:武汉SEO闵涛  文章来源:敏韬网  点击数10371  更新时间:2009/4/23 15:43:16  文章录入:mintao  责任编辑:mintao
;     Case 19
            Form_main.Image_block(by * 10 + bx).Visible = False
            by = by + 1
            Call show19(bx, by)
    End Select
End Sub
Sub clear(b_kinds As Integer, now_y As Integer) ''''满行后清行
   '''' Dim i As Integer
    ''''Dim q As Integer
    Select Case b_kinds
        Case 1, 2, 3, 4, 5, 6, 12, 14, 17
            p = 1
        Case 7
            p = 0
        Case 8, 9, 10, 11, 13, 16, 15, 18
            p = 2
        Case 19
            p = 3
    End Select
    For q = 0 To p
        If canClear(now_y + q) Then
            Call clearOneLine(now_y + q)
        End If
    Next
End Sub
Function canClear(l As Integer) As Boolean
    ''''Dim a As Integer
    For a = (l * 10 + 0) To (l * 10 + 9)
        If Form_main.Image_block(a).Visible = False Then
            canClear = False
            Exit Function
        End If
    Next
    canClear = True
End Function
Sub clearOneLine(lineNum As Integer)
    ''''Dim n As Integer
    ''''Dim m As Integer
    For n = lineNum To 1 Step -1
        For m = 0 To 9
            Form_main.Image_block(n * 10 + m).Visible = Form_main.Image_block((n - 1) * 10 + m).Visible
        Next
    Next
End Sub

Sub is_full(block_end As Integer)  ''''是否游戏结束
    Select Case block_end
        Case 1 ''''田字型
            If Form_main.Image_block(by * 10 + 3).Visible = True Or Form_main.Image_block(by * 10 + 4).Visible = True Or Form_main.Image_block(by * 10 + 13).Visible = True Or Form_main.Image_block(by * 10 + 14).Visible = True Then
                Form_main.Timer_speed.Enabled = False
                Form_main.timer_now.Enabled = False
                MsgBox "游戏结束!^_^"
            Else
                Form_main.Timer_speed = True
            End If
        Case 2 ''''Z字型
            If Form_main.Image_block(by * 10 + 3).Visible = True Or Form_main.Image_block(by * 10 + 4).Visible = True Or Form_main.Image_block(by * 10 + 14).Visible = True Or Form_main.Image_block(by * 10 + 15).Visible = True Then
                Form_main.Timer_speed.Enabled = False
                Form_main.timer_now.Enabled = False
                MsgBox "游戏结束!^_^"
                            Else
                Form_main.Timer_speed = True
            End If
        Case 3 ''''反Z字型
            If Form_main.Image_block(by * 10 + 3).Visible = True Or Form_main.Image_block(by * 10 + 4).Visible = True Or Form_main.Image_block(by * 10 + 13).Visible = True Or Form_main.Image_block(by * 10 + 14).Visible = True Then
                Form_main.Timer_speed.Enabled = False
                Form_main.timer_now.Enabled = False
                MsgBox "游戏结束!^_^"
                            Else
                Form_main.Timer_speed = True
            End If
        Case 4 ''''土字型
            If Form_main.Image_block(by * 10 + 3).Visible = True Or Form_main.Image_block(by * 10 + 4).Visible = True Or Form_main.Image_block(by * 10 + 13).Visible = True Or Form_main.Image_block(by * 10 + 14).Visible = True Then
                Form_main.Timer_speed.Enabled = False
                Form_main.timer_now.Enabled = False
                MsgBox "游戏结束!^_^"
                            Else
                Form_main.Timer_speed = True
            End If
        Case 5 ''''L字型
            If Form_main.Image_block(by * 10 + 3).Visible = True Or Form_main.Image_block(by * 10 + 4).Visible = True Or Form_main.Image_block(by * 10 + 13).Visible = True Or Form_main.Image_block(by * 10 + 14).Visible = True Then
                Form_main.Timer_speed.Enabled = False
                Form_main.timer_now.Enabled = False
                MsgBox "游戏结束!^_^"
                            Else
                Form_main.Timer_speed = True
            End If
        Case 6 ''''反L字型
            If Form_main.Image_block(by * 10 + 3).Visible = True Or Form_main.Image_block(by * 10 + 4).Visible = True Or Form_main.Image_block(by * 10 + 13).Visible = True Or Form_main.Image_block(by * 10 + 14).Visible = True Then
                Form_main.Timer_speed.Enabled = False
                Form_main.timer_now.Enabled = False
                MsgBox "游戏结束!^_^"
                          &n

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口