⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.frm

📁 VB写的魔方游戏
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      Case 2
        If Direction = 1 Then
            Obj(Into(9)).Read_Trajectory 33
            Obj(Into(10)).Read_Trajectory 34
            Obj(Into(11)).Read_Trajectory 35
            Obj(Into(12)).Read_Trajectory 36
            Obj(Into(13)).Read_Trajectory 37
            Obj(Into(14)).Read_Trajectory 38
            Obj(Into(15)).Read_Trajectory 39
            Obj(Into(16)).Read_Trajectory 40
          Else
            Obj(Into(9)).Read_Trajectory 35
            Obj(Into(10)).Read_Trajectory 36
            Obj(Into(11)).Read_Trajectory 37
            Obj(Into(12)).Read_Trajectory 38
            Obj(Into(13)).Read_Trajectory 39
            Obj(Into(14)).Read_Trajectory 40
            Obj(Into(15)).Read_Trajectory 33
            Obj(Into(16)).Read_Trajectory 34
        End If

      Case 3
        If Direction = 1 Then
            Obj(Into(17)).Read_Trajectory 17
            Obj(Into(18)).Read_Trajectory 18
            Obj(Into(11)).Read_Trajectory 19
            Obj(Into(3)).Read_Trajectory 20
            Obj(Into(19)).Read_Trajectory 21
            Obj(Into(20)).Read_Trajectory 22
            Obj(Into(8)).Read_Trajectory 23
            Obj(Into(16)).Read_Trajectory 24
          Else
            Obj(Into(17)).Read_Trajectory 19
            Obj(Into(18)).Read_Trajectory 20
            Obj(Into(11)).Read_Trajectory 21
            Obj(Into(3)).Read_Trajectory 22
            Obj(Into(19)).Read_Trajectory 23
            Obj(Into(20)).Read_Trajectory 24
            Obj(Into(8)).Read_Trajectory 17
            Obj(Into(16)).Read_Trajectory 18
        End If

      Case 4
        If Direction = 1 Then
            Obj(Into(7)).Read_Trajectory 41
            Obj(Into(15)).Read_Trajectory 42
            Obj(Into(21)).Read_Trajectory 43
            Obj(Into(22)).Read_Trajectory 44
            Obj(Into(12)).Read_Trajectory 45
            Obj(Into(4)).Read_Trajectory 46
            Obj(Into(23)).Read_Trajectory 47
            Obj(Into(24)).Read_Trajectory 48
          Else
            Obj(Into(7)).Read_Trajectory 43
            Obj(Into(15)).Read_Trajectory 44
            Obj(Into(21)).Read_Trajectory 45
            Obj(Into(22)).Read_Trajectory 46
            Obj(Into(12)).Read_Trajectory 47
            Obj(Into(4)).Read_Trajectory 48
            Obj(Into(23)).Read_Trajectory 41
            Obj(Into(24)).Read_Trajectory 42
        End If

      Case 5
        If Direction = 1 Then
            Obj(Into(2)).Read_Trajectory 25
            Obj(Into(10)).Read_Trajectory 26
            Obj(Into(18)).Read_Trajectory 27
            Obj(Into(22)).Read_Trajectory 28
            Obj(Into(13)).Read_Trajectory 29
            Obj(Into(5)).Read_Trajectory 30
            Obj(Into(23)).Read_Trajectory 31
            Obj(Into(19)).Read_Trajectory 32
          Else
            Obj(Into(2)).Read_Trajectory 27
            Obj(Into(10)).Read_Trajectory 28
            Obj(Into(18)).Read_Trajectory 29
            Obj(Into(22)).Read_Trajectory 30
            Obj(Into(13)).Read_Trajectory 31
            Obj(Into(5)).Read_Trajectory 32
            Obj(Into(23)).Read_Trajectory 25
            Obj(Into(19)).Read_Trajectory 26
        End If

      Case 6
        If Direction = 1 Then
            Obj(Into(1)).Read_Trajectory 9
            Obj(Into(9)).Read_Trajectory 10
            Obj(Into(17)).Read_Trajectory 11
            Obj(Into(21)).Read_Trajectory 12
            Obj(Into(14)).Read_Trajectory 13
            Obj(Into(6)).Read_Trajectory 14
            Obj(Into(24)).Read_Trajectory 15
            Obj(Into(20)).Read_Trajectory 16
          Else
            Obj(Into(1)).Read_Trajectory 11
            Obj(Into(9)).Read_Trajectory 12
            Obj(Into(17)).Read_Trajectory 13
            Obj(Into(21)).Read_Trajectory 14
            Obj(Into(14)).Read_Trajectory 15
            Obj(Into(6)).Read_Trajectory 16
            Obj(Into(24)).Read_Trajectory 9
            Obj(Into(20)).Read_Trajectory 10
        End If
    End Select

End Sub

Private Sub Start()

  Dim I As Integer

    Hits_Label = ""

    Into(1) = 1
    Into(2) = 7
    Into(9) = 13
    Into(10) = 19

    Into(17) = 2
    Into(18) = 8
    Into(21) = 14
    Into(22) = 20

    Into(5) = 3
    Into(6) = 9
    Into(13) = 15
    Into(14) = 21

    Into(19) = 4
    Into(20) = 10
    Into(23) = 16
    Into(24) = 22

    Into(3) = 5
    Into(4) = 11
    Into(11) = 17
    Into(12) = 23

    Into(7) = 6
    Into(8) = 12
    Into(15) = 18
    Into(16) = 24

    For I = 1 To 24
        Obj(I).Color = I Mod 6 + 1
        Obj(I).Image1 = LoadResPicture(200 + (I Mod 6 + 1), 0)
        Obj(I).Show , Me
        Obj(I).Make_Transparent
        DoEvents
    Next I

    Obj(1).Move 4980, 1320
    Obj(2).Move 4689, 1974
    Obj(3).Move 3825, 3015
    Obj(4).Move 3345, 4080
    Obj(5).Move 2760, 1830
    Obj(6).Move 6180, 2295
    Obj(7).Move 4704, 1306
    Obj(8).Move 4344, 1974
    Obj(9).Move 4170, 3045
    Obj(10).Move 3690, 4110
    Obj(11).Move 2625, 2005
    Obj(12).Move 6210, 2100
    Obj(13).Move 4905, 1515
    Obj(14).Move 4590, 2190
    Obj(15).Move 3927, 2795
    Obj(16).Move 3450, 3855
    Obj(17).Move 3037, 1870
    Obj(18).Move 5895, 2250
    Obj(19).Move 4620, 1470
    Obj(20).Move 4275, 2175
    Obj(21).Move 4271, 2825
    Obj(22).Move 3765, 3870
    Obj(23).Move 2895, 2034
    Obj(24).Move 5940, 2070

End Sub

Private Sub Change_position(X As Integer)

  Dim I As Integer

    For I = 1 To 24
        BKP_Into(I) = Into(I)
    Next I

    Select Case X
      Case 1
        If Direction = 1 Then
            Into(1) = BKP_Into(3)
            Into(2) = BKP_Into(4)
            Into(3) = BKP_Into(5)
            Into(4) = BKP_Into(6)
            Into(5) = BKP_Into(7)
            Into(6) = BKP_Into(8)
            Into(7) = BKP_Into(1)
            Into(8) = BKP_Into(2)
          Else
            Into(1) = BKP_Into(7)
            Into(2) = BKP_Into(8)
            Into(3) = BKP_Into(1)
            Into(4) = BKP_Into(2)
            Into(5) = BKP_Into(3)
            Into(6) = BKP_Into(4)
            Into(7) = BKP_Into(5)
            Into(8) = BKP_Into(6)
        End If

      Case 2
        If Direction = 1 Then
            Into(15) = BKP_Into(9)
            Into(16) = BKP_Into(10)
            Into(9) = BKP_Into(11)
            Into(10) = BKP_Into(12)
            Into(11) = BKP_Into(13)
            Into(12) = BKP_Into(14)
            Into(13) = BKP_Into(15)
            Into(14) = BKP_Into(16)
          Else
            Into(15) = BKP_Into(13)
            Into(16) = BKP_Into(14)
            Into(9) = BKP_Into(15)
            Into(10) = BKP_Into(16)
            Into(11) = BKP_Into(9)
            Into(12) = BKP_Into(10)
            Into(13) = BKP_Into(11)
            Into(14) = BKP_Into(12)
        End If

      Case 3
        If Direction = 1 Then
            Into(8) = BKP_Into(17)
            Into(16) = BKP_Into(18)
            Into(17) = BKP_Into(11)
            Into(18) = BKP_Into(3)
            Into(11) = BKP_Into(19)
            Into(3) = BKP_Into(20)
            Into(19) = BKP_Into(8)
            Into(20) = BKP_Into(16)
          Else
            Into(8) = BKP_Into(19)
            Into(16) = BKP_Into(20)
            Into(17) = BKP_Into(8)
            Into(18) = BKP_Into(16)
            Into(11) = BKP_Into(17)
            Into(3) = BKP_Into(18)
            Into(19) = BKP_Into(11)
            Into(20) = BKP_Into(3)
        End If

      Case 4
        If Direction = 1 Then
            Into(7) = BKP_Into(21)
            Into(15) = BKP_Into(22)
            Into(21) = BKP_Into(12)
            Into(22) = BKP_Into(4)
            Into(12) = BKP_Into(23)
            Into(4) = BKP_Into(24)
            Into(23) = BKP_Into(7)
            Into(24) = BKP_Into(15)
          Else
            Into(7) = BKP_Into(23)
            Into(15) = BKP_Into(24)
            Into(21) = BKP_Into(7)
            Into(22) = BKP_Into(15)
            Into(12) = BKP_Into(21)
            Into(4) = BKP_Into(22)
            Into(23) = BKP_Into(12)
            Into(24) = BKP_Into(4)
        End If

      Case 5
        If Direction = 1 Then
            Into(23) = BKP_Into(2)
            Into(19) = BKP_Into(10)
            Into(2) = BKP_Into(18)
            Into(10) = BKP_Into(22)
            Into(18) = BKP_Into(13)
            Into(22) = BKP_Into(5)
            Into(13) = BKP_Into(23)
            Into(5) = BKP_Into(19)
          Else
            Into(23) = BKP_Into(13)
            Into(19) = BKP_Into(5)
            Into(2) = BKP_Into(23)
            Into(10) = BKP_Into(19)
            Into(18) = BKP_Into(2)
            Into(22) = BKP_Into(10)
            Into(13) = BKP_Into(18)
            Into(5) = BKP_Into(22)
        End If

      Case 6
        If Direction = 1 Then
            Into(24) = BKP_Into(1)
            Into(20) = BKP_Into(9)
            Into(1) = BKP_Into(17)
            Into(9) = BKP_Into(21)
            Into(17) = BKP_Into(14)
            Into(21) = BKP_Into(6)
            Into(14) = BKP_Into(24)
            Into(6) = BKP_Into(20)
          Else
            Into(24) = BKP_Into(14)
            Into(20) = BKP_Into(6)
            Into(1) = BKP_Into(24)
            Into(9) = BKP_Into(20)
            Into(17) = BKP_Into(1)
            Into(21) = BKP_Into(9)
            Into(14) = BKP_Into(17)
            Into(6) = BKP_Into(21)
        End If

    End Select

End Sub

Private Sub Set_Direction()

  Dim I As Integer

    For I = 1 To 24
        If Direction = 1 Then
            Obj(I).Actual_Step = 1
          Else
            Obj(I).Actual_Step = Obj(I).Step_Amount - 1
        End If
    Next I

End Sub

Private Function Has_any_active() As Boolean

  Dim I As Integer

    For I = 1 To 24
        If Obj(I).Active Then
            Has_any_active = True
            Exit Function
        End If
    Next I

End Function

Private Function Assembly() As Boolean

  Dim X As Integer

    If Obj(Into(1)).Color = Obj(Into(2)).Color _
       And _
       Obj(Into(1)).Color = Obj(Into(10)).Color _
       And _
       Obj(Into(1)).Color = Obj(Into(9)).Color Then
        X = X + 1
    End If

    If Obj(Into(7)).Color = Obj(Into(8)).Color _
       And _
       Obj(Into(7)).Color = Obj(Into(15)).Color _
       And _
       Obj(Into(7)).Color = Obj(Into(16)).Color Then
        X = X + 1
    End If

    If Obj(Into(5)).Color = Obj(Into(6)).Color _
       And _
       Obj(Into(5)).Color = Obj(Into(13)).Color _
       And _
       Obj(Into(5)).Color = Obj(Into(14)).Color Then
        X = X + 1
    End If

    If Obj(Into(3)).Color = Obj(Into(4)).Color _
       And _
       Obj(Into(3)).Color = Obj(Into(11)).Color _
       And _
       Obj(Into(3)).Color = Obj(Into(12)).Color Then
        X = X + 1
    End If

    If Obj(Into(17)).Color = Obj(Into(18)).Color _
       And _
       Obj(Into(17)).Color = Obj(Into(21)).Color _
       And _
       Obj(Into(17)).Color = Obj(Into(22)).Color Then
        X = X + 1
    End If

    If Obj(Into(19)).Color = Obj(Into(20)).Color _
       And _
       Obj(Into(19)).Color = Obj(Into(23)).Color _
       And _
       Obj(Into(19)).Color = Obj(Into(24)).Color Then
        X = X + 1
    End If

    If X = 6 Then
        Assembly = True
    End If

End Function

Private Sub Show_Win_Message()

    MsgBox "恭喜! 你已经完成了小球的调整。总共用了:" & Hits_Label & "次调整。", vbOKOnly, "游戏结束"

End Sub

Private Sub Form_Resize()

    If WindowState = 0 Then
        WindowState = 2
    End If

End Sub

Private Sub New_Cmd_Click()

    Start

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -