Public feed #726029

Miscellany

public text v1 · immutable
Raw Edit
·published 2007-10-04 20:53 UTC
rendered paste body
Dim intColorsPicked As Integer
Dim intNums(1 To 1000) As Integer
Dim intChecked As Integer
Dim intScore As Integer
Dim Sngcolor(0 To 3) As Single

Private Sub CmdRestart_Click()
    intChecked = 0
    intColorsPicked = 0
    intScore = 0
        MsgBox "good luck on your next game"
    Unload Me
        FrmSimon.Show
End Sub

Private Sub CmdStart_Click()
    Me.CmdStart.Caption = "Next"
        Dim i As Integer
    
    intColorsPicked = intColorsPicked + 1
    intNums(intColorsPicked) = Int(Rnd * 4)
        
    For i = 1 To intColorsPicked
        Me.LblColor(intNums(i)).BackColor = Sngcolor(intNums(i))
        Delay 0.2
        Me.LblColor(intNums(i)).BackColor = vbWhite
        Delay 0.2
        Me.LblColor(intNums(i)).BackColor = Sngcolor(intNums(i))
    Next i
        intChecked = 0
End Sub

Private Sub Command1_Click()
    Unload Me
    FrmSimon.Show
End Sub

Private Sub Form_Load()
    Randomize Timer
    intColorsPicked = 0
    Sngcolor(0) = vbBlue
    Sngcolor(1) = vbRed
    Sngcolor(2) = vbYellow
    Sngcolor(3) = vbGreen
End Sub

Private Sub LblColor_Click(Index As Integer)
        Dim k As Integer
        Me.LblColor(Index).BackColor = Sngcolor(Index)
        Delay 0.2
        Me.LblColor(Index).BackColor = vbWhite
        Delay 0.2
        Me.LblColor(Index).BackColor = Sngcolor(Index)
        intChecked = intChecked + 1
        If Index = intNums(intChecked) Then
             If intChecked = intColorsPicked Then
                MsgBox "level pass"
                intScore = intScore + 1
                Me.LblScore.Caption = intScore
                Call CmdStart_Click
            End If
        Else
            MsgBox "You Lose"
            MsgBox "click restart to continue"
        End If
End Sub

Private Sub LblScore_Click()

End Sub

Private Sub LblTitle_Click()

End Sub

Private Sub MnuQuit_Click()
    End
End Sub

Private Sub Timer1_Timer()
    Timer1.Enabled = False
End Sub


Private Sub Delay(t As Single)
    Timer1.Interval = t * 1000
    Timer1.Enabled = True
    Do While Timer1.Enabled
        DoEvents
    Loop
End Sub