home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / mindbo1a / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-28  |  16.6 KB  |  484 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Mind Boggle "
  6.    ClientHeight    =   6060
  7.    ClientLeft      =   3855
  8.    ClientTop       =   3090
  9.    ClientWidth     =   6960
  10.    Icon            =   "Form1.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   6060
  15.    ScaleWidth      =   6960
  16.    Visible         =   0   'False
  17.    Begin VB.Timer Timer6 
  18.       Enabled         =   0   'False
  19.       Interval        =   10
  20.       Left            =   3240
  21.       Top             =   3720
  22.    End
  23.    Begin VB.Timer Timer5 
  24.       Enabled         =   0   'False
  25.       Interval        =   500
  26.       Left            =   5280
  27.       Top             =   4440
  28.    End
  29.    Begin VB.Timer Timer4 
  30.       Enabled         =   0   'False
  31.       Interval        =   10
  32.       Left            =   3720
  33.       Top             =   4440
  34.    End
  35.    Begin VB.Timer Timer3 
  36.       Enabled         =   0   'False
  37.       Interval        =   400
  38.       Left            =   2520
  39.       Top             =   4440
  40.    End
  41.    Begin MSComctlLib.Toolbar Toolbar1 
  42.       Align           =   2  'Align Bottom
  43.       Height          =   645
  44.       Left            =   0
  45.       TabIndex        =   9
  46.       Top             =   5415
  47.       Width           =   6960
  48.       _ExtentX        =   12277
  49.       _ExtentY        =   1138
  50.       ButtonWidth     =   1588
  51.       ButtonHeight    =   979
  52.       Appearance      =   1
  53.       ImageList       =   "ImageList1"
  54.       _Version        =   393216
  55.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  56.          NumButtons      =   3
  57.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  58.             Caption         =   "Start Game"
  59.             Key             =   "New"
  60.             ImageIndex      =   1
  61.          EndProperty
  62.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  63.             Caption         =   "space"
  64.             Key             =   "space"
  65.             Style           =   4
  66.             Object.Width           =   5150
  67.          EndProperty
  68.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  69.             Caption         =   "End Game"
  70.             Key             =   "End"
  71.             ImageIndex      =   2
  72.          EndProperty
  73.       EndProperty
  74.       BorderStyle     =   1
  75.    End
  76.    Begin MSComctlLib.ImageList ImageList1 
  77.       Left            =   720
  78.       Top             =   2640
  79.       _ExtentX        =   1005
  80.       _ExtentY        =   1005
  81.       BackColor       =   -2147483643
  82.       ImageWidth      =   19
  83.       ImageHeight     =   17
  84.       MaskColor       =   8421504
  85.       _Version        =   393216
  86.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  87.          NumListImages   =   2
  88.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  89.             Picture         =   "Form1.frx":000C
  90.             Key             =   ""
  91.          EndProperty
  92.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  93.             Picture         =   "Form1.frx":016C
  94.             Key             =   ""
  95.          EndProperty
  96.       EndProperty
  97.    End
  98.    Begin VB.Timer Timer2 
  99.       Enabled         =   0   'False
  100.       Interval        =   900
  101.       Left            =   1440
  102.       Top             =   4440
  103.    End
  104.    Begin VB.Timer Timer1 
  105.       Enabled         =   0   'False
  106.       Interval        =   1
  107.       Left            =   480
  108.       Top             =   4440
  109.    End
  110.    Begin VB.Label lblShowScore 
  111.       Alignment       =   2  'Center
  112.       BackStyle       =   0  'Transparent
  113.       BeginProperty Font 
  114.          Name            =   "MS Sans Serif"
  115.          Size            =   13.5
  116.          Charset         =   0
  117.          Weight          =   400
  118.          Underline       =   0   'False
  119.          Italic          =   0   'False
  120.          Strikethrough   =   0   'False
  121.       EndProperty
  122.       ForeColor       =   &H00C0C0C0&
  123.       Height          =   375
  124.       Left            =   240
  125.       TabIndex        =   10
  126.       Top             =   240
  127.       Width           =   375
  128.    End
  129.    Begin VB.Label lblLabel2 
  130.       BackColor       =   &H00FFC0FF&
  131.       BorderStyle     =   1  'Fixed Single
  132.       Height          =   1815
  133.       Index           =   3
  134.       Left            =   -240
  135.       TabIndex        =   8
  136.       Top             =   1800
  137.       Visible         =   0   'False
  138.       Width           =   2415
  139.    End
  140.    Begin VB.Label lblLabel2 
  141.       BackColor       =   &H008080FF&
  142.       BorderStyle     =   1  'Fixed Single
  143.       Height          =   1815
  144.       Index           =   0
  145.       Left            =   0
  146.       TabIndex        =   0
  147.       Top             =   0
  148.       Visible         =   0   'False
  149.       Width           =   2175
  150.    End
  151.    Begin VB.Label lblLabel2 
  152.       BackColor       =   &H000000FF&
  153.       BorderStyle     =   1  'Fixed Single
  154.       Height          =   1815
  155.       Index           =   4
  156.       Left            =   2160
  157.       TabIndex        =   7
  158.       Top             =   1800
  159.       Width           =   2415
  160.    End
  161.    Begin VB.Label lblLabel2 
  162.       BackColor       =   &H0000FFFF&
  163.       BorderStyle     =   1  'Fixed Single
  164.       Height          =   1815
  165.       Index           =   1
  166.       Left            =   2160
  167.       TabIndex        =   6
  168.       Top             =   0
  169.       Visible         =   0   'False
  170.       Width           =   2415
  171.    End
  172.    Begin VB.Label lblLabel2 
  173.       BackColor       =   &H0080C0FF&
  174.       BorderStyle     =   1  'Fixed Single
  175.       Height          =   1815
  176.       Index           =   8
  177.       Left            =   4560
  178.       TabIndex        =   5
  179.       Top             =   3600
  180.       Visible         =   0   'False
  181.       Width           =   2415
  182.    End
  183.    Begin VB.Label lblLabel2 
  184.       BackColor       =   &H00FF8080&
  185.       BorderStyle     =   1  'Fixed Single
  186.       Height          =   1815
  187.       Index           =   5
  188.       Left            =   4560
  189.       TabIndex        =   4
  190.       Top             =   1800
  191.       Visible         =   0   'False
  192.       Width           =   2415
  193.    End
  194.    Begin VB.Label lblLabel2 
  195.       BackColor       =   &H00800080&
  196.       BorderStyle     =   1  'Fixed Single
  197.       Height          =   1815
  198.       Index           =   7
  199.       Left            =   2160
  200.       TabIndex        =   3
  201.       Top             =   3600
  202.       Visible         =   0   'False
  203.       Width           =   2415
  204.    End
  205.    Begin VB.Label lblLabel2 
  206.       BackColor       =   &H00008080&
  207.       BorderStyle     =   1  'Fixed Single
  208.       Height          =   1815
  209.       Index           =   6
  210.       Left            =   0
  211.       TabIndex        =   2
  212.       Top             =   3600
  213.       Visible         =   0   'False
  214.       Width           =   2175
  215.    End
  216.    Begin VB.Label lblLabel2 
  217.       BackColor       =   &H0000FF00&
  218.       BorderStyle     =   1  'Fixed Single
  219.       Height          =   1815
  220.       Index           =   2
  221.       Left            =   4560
  222.       TabIndex        =   1
  223.       Top             =   0
  224.       Visible         =   0   'False
  225.       Width           =   2415
  226.    End
  227. Attribute VB_Name = "Form1"
  228. Attribute VB_GlobalNameSpace = False
  229. Attribute VB_Creatable = False
  230. Attribute VB_PredeclaredId = True
  231. Attribute VB_Exposed = False
  232. Option Explicit
  233. 'Eric Larson
  234. 'This program was my final class project for a vb 6.0 class
  235.     Dim intCounter6 As Integer
  236.     Dim lngVBcolors(0 To 7) As Long
  237.     Dim intNum3 As Integer
  238.     Dim intIndex As Integer
  239.     Dim intlevelNum As Integer
  240.     Dim intCheckNum As Integer
  241.     Dim intRandomNums(0 To 11) As Integer
  242.     Dim intCounter As Integer
  243.     Dim intCounter1 As Integer
  244.     Dim intCounter2 As Integer
  245.     Dim intLabelViewA(0 To 11) As Integer
  246.     Dim intNextLevel As Integer
  247.  Private Sub Form_Load()
  248.     Dim intNum As Integer
  249.     With Form1
  250.         .Top = (Screen.Height - Form1.Height) / 2
  251.         .Left = (Screen.Width - Form1.Width) / 2
  252.     End With
  253.     Timer2.Enabled = True
  254.     For intNum = 0 To 8
  255.         lblLabel2(intNum).Visible = True
  256.     Next intNum
  257.     intScore = 3
  258. End Sub
  259. Private Sub Form_Unload(Cancel As Integer)
  260.     Const conBtns As Integer = vbYesNo + vbExclamation + vbDefaultButton1 + vbApplicationModal
  261.     Const strHighest As String = "Total Blocks:  "
  262.     Const strName As String = "Name:  "
  263.     Const strHighestScore As String = "Highest Score"
  264.     Dim lngRc As Long
  265.     Dim strNameAndScore As String
  266.     Dim intDatScore As Integer
  267.     Dim strDatName As String
  268.     Dim intUserResponse As Integer
  269.     intUserResponse = MsgBox("Sure you want to exit?", conBtns, "Mind Boggle")
  270.     If intUserResponse = vbNo Then
  271.         Cancel = 1
  272.     Else
  273.         Open App.Path & "\Winner.dat" For Input As #1
  274.         Input #1, strDatName, intDatScore
  275.         Close #1
  276.         If intScore > intDatScore Then
  277.             strDatName = InputBox("Enter name:", "Mind Boggle")
  278.             If strDatName = "" Then
  279.                 Open App.Path & "\Winner.dat" For Input As #1
  280.                 Input #1, strDatName, intDatScore
  281.                 Close #1
  282.                 strNameAndScore = strHighestScore & vbNewLine & vbNewLine & strName & strDatName & _
  283.                 vbNewLine & strHighest & intDatScore
  284.                 MsgBox strNameAndScore, vbOKOnly, "Mind Boggle"
  285.                 lngRc = sndPlaySound(App.Path & "\Bell.wav", 0)
  286.                 Exit Sub
  287.             Else
  288.                 Open App.Path & "\Winner.dat" For Output As #1
  289.                 Write #1, strDatName, intScore
  290.                 Close #1
  291.                 strNameAndScore = strHighestScore & vbNewLine & vbNewLine & strName & strDatName & _
  292.                 vbNewLine & vbNewLine & strHighest & intScore
  293.                 MsgBox strNameAndScore, vbOKOnly, "Mind Boggle"
  294.             End If
  295.         Else
  296.             Open App.Path & "\Winner.dat" For Input As #1
  297.             Input #1, strDatName, intDatScore
  298.             Close #1
  299.             strNameAndScore = strHighestScore & vbNewLine & vbNewLine & strName & strDatName & _
  300.              vbNewLine & vbNewLine & strHighest & intDatScore
  301.             MsgBox strNameAndScore, vbOKOnly, "Mind Boggle"
  302.         End If
  303.         lngRc = sndPlaySound(App.Path & "\Bell.wav", 0)
  304.      End If
  305. End Sub
  306. Private Sub lblLabel2_Click(index As Integer)
  307.     Dim intNum1 As Integer
  308.     Dim intLabelPickA(0 To 11) As Integer
  309.     Dim lngRc As Long
  310.     Const conBtns As Integer = vbOKOnly + vbExclamation + vbDefaultButton1 + vbApplicationModal
  311.     Dim intUserResponse As Integer
  312.     lblLabel2(index).Visible = False
  313.     lngRc = sndPlaySound(App.Path & "\Whoosh.wav", 1)
  314.     Timer4.Enabled = True
  315.     intIndex = index
  316.     intLabelPickA(intCounter1) = index
  317.     If intCounter2 <> intlevelNum Then
  318.         If intLabelPickA(intCounter) = intLabelViewA(intCounter) Then
  319.             intCounter = intCounter + 1
  320.             intCounter1 = intCounter1 + 1
  321.             intCounter2 = intCounter2 + 1
  322.             Exit Sub
  323.         Else
  324.             intCounter = 0
  325.             intCounter1 = 0
  326.             For intNum1 = 0 To 8
  327.                 lblLabel2(intNum1).Enabled = False
  328.             Next intNum1
  329.             intUserResponse = MsgBox("WRONG!", conBtns, "Great Fun")
  330.             intNextLevel = 0
  331.             Exit Sub
  332.         End If
  333.     Else
  334.         If intLabelPickA(intCounter) = intLabelViewA(intCounter) Then
  335.             intCounter = 0
  336.             intCounter1 = 0
  337.             intNextLevel = intNextLevel + 1
  338.             For intNum1 = 0 To 8
  339.                 lblLabel2(intNum1).Enabled = False
  340.             Next intNum1
  341.             Timer5.Enabled = True
  342.         Else
  343.             intCounter = 0
  344.             intCounter1 = 0
  345.             For intNum1 = 0 To 8
  346.                 lblLabel2(intNum1).Enabled = False
  347.             Next intNum1
  348.             intUserResponse = MsgBox("WRONG!", conBtns, "Great Fun")
  349.             intNextLevel = 0
  350.         End If
  351.     End If
  352.       
  353. End Sub
  354. Private Sub Timer1_Timer()
  355.     Dim intNum As Integer
  356.     Dim lngRc As Long
  357.     lngRc = sndPlaySound(App.Path & "\Whoosh.wav", 1)
  358.     For intNum = 0 To 8
  359.         lblLabel2(intNum).BackColor = vbYellow
  360.     Next intNum
  361.         
  362. End Sub
  363. Private Sub Timer2_Timer()
  364.     Timer1.Enabled = True
  365.     Timer2.Enabled = False
  366.     Timer6.Enabled = True
  367. End Sub
  368. Private Sub Timer3_Timer()
  369.     Dim lngRc As Long
  370.     Dim intNum As Integer
  371.     Dim intNum1 As Integer
  372.     For intNum1 = 0 To 8
  373.             lblLabel2(intNum1).Enabled = False
  374.         Next intNum1
  375.     intlevelNum = 3
  376.     intCounter2 = 1
  377.     intlevelNum = intlevelNum + intNextLevel
  378.     If intlevelNum >= intScore Then
  379.         lblShowScore.Caption = intScore
  380.     End If
  381.     If intlevelNum - 1 > intScore Then
  382.         intScore = intlevelNum - 1
  383.     End If
  384.     If intCounter = 0 Then
  385.         For intNum = 0 To 11
  386.             Randomize
  387.             intRandomNums(intNum) = Int((8 - 0 + 1) * Rnd + 0)
  388.         Next intNum
  389.     End If
  390.     If intlevelNum <> intCounter Then
  391.         Do While intCheckNum = intRandomNums(intCounter)
  392.             Randomize
  393.             intRandomNums(intCounter) = Int((8 - 0 + 1) * Rnd + 0)
  394.         Loop
  395.         lngRc = sndPlaySound(App.Path & "\Whoosh.wav", 1)
  396.         If intNum3 >= 7 Then
  397.             intNum3 = 0
  398.         End If
  399.         Select Case intNum3
  400.             Case Is = 0
  401.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbMagenta Then
  402.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbGreen
  403.                 Else
  404.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbMagenta
  405.                 End If
  406.             Case Is = 1
  407.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbYellow Then
  408.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbBlack
  409.                 Else
  410.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbYellow
  411.                 End If
  412.             Case Is = 2
  413.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbRed Then
  414.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbBlue
  415.                 Else
  416.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbRed
  417.                 End If
  418.             Case Is = 3
  419.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbCyan Then
  420.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbMagenta
  421.                 Else
  422.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbCyan
  423.                 End If
  424.             Case Is = 4
  425.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbWhite Then
  426.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbGreen
  427.                 Else
  428.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbWhite
  429.                 End If
  430.             Case Is = 5
  431.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbBlue Then
  432.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbRed
  433.                 Else
  434.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbBlue
  435.                 End If
  436.             Case Is = 6
  437.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbBlack Then
  438.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbYellow
  439.                 Else
  440.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbBlack
  441.                 End If
  442.             Case Is = 7
  443.                 If lblLabel2(intRandomNums(intCounter)).BackColor = vbGreen Then
  444.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbMagenta
  445.                 Else
  446.                     lblLabel2(intRandomNums(intCounter)).BackColor = vbGreen
  447.                 End If
  448.         End Select
  449.         intNum3 = intNum3 + 1
  450.         intLabelViewA(intCounter) = intRandomNums(intCounter)
  451.         intCheckNum = intRandomNums(intCounter)
  452.         intCounter = intCounter + 1
  453.     Else
  454.         intCounter = 0
  455.         For intNum1 = 0 To 8
  456.             lblLabel2(intNum1).Enabled = True
  457.         Next intNum1
  458.         Timer3.Enabled = False
  459.     End If
  460.       
  461. End Sub
  462. Private Sub Timer4_Timer()
  463.     lblLabel2(intIndex).Visible = True
  464.     Timer4.Enabled = False
  465. End Sub
  466. Private Sub Timer5_Timer()
  467.    Timer3.Enabled = True
  468.    Timer5.Enabled = False
  469. End Sub
  470. Private Sub Timer6_Timer()
  471.     Timer1.Interval = False
  472.     Timer6.Enabled = False
  473. End Sub
  474. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  475.     Select Case Button.Key
  476.     Case "New"
  477.         intNextLevel = 0
  478.         Timer3.Enabled = True
  479.     Case "End"
  480.         Unload Me
  481.     End Select
  482.       
  483. End Sub
  484.