VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Its Small Game for those who are interested in Colours.

by Abdul Rahman (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 9th February 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Its Small Game for those who are interested in Colours.

Rate Its Small Game for those who are interested in Colours.



Dim k
Dim tr1 As Boolean
Dim br1 As Boolean
Dim bl1 As Boolean
Dim tl1 As Boolean
Dim att As Integer

Private Sub Command1_Click()
Timer1.Enabled = True
tr1 = False
tl1 = False
bl1 = False
br1 = False
tcnt.Enabled = True
If Command1.Caption = "End" Then
    End
End If
Command1.Caption = "End"

End Sub

Private Sub Form_Load()
att = 0
cnt.Caption = 100
End Sub

Private Sub g1_Click()
If Command1.Caption = "End" Then
    If g1.BackColor = c1.BackColor Then
        MsgBox "Your Score is:" & Val(cnt.Caption), , "Colour Game"
        a = MsgBox("Do you Want to Continue?", vbYesNo, "Colour Game")
        If a = 6 Then
            att = 0
            cnt.Caption = 100
        Else
            End
        End If
    Else
        att = att + 1
        MsgBox att & " attempt Failed", , "Colour Game"
        If att = 3 Then
            MsgBox "Better Luck Next Time", , "Colour Game"
            End
        End If
    End If
End If
End Sub

Private Sub tcnt_Timer()
cnt.Caption = Val(cnt.Caption) - 1
If Val(cnt.Caption) = 0 Then
    MsgBox "Sorry, U could not finish in Time", , "Colour Game"
    End
End If
End Sub

Private Sub Timer1_Timer()
    If c1.Left < 5000 Then
        c1.Left = c1.Left + 50
    Else
        If tr1 = False Then
            k = c1.BackColor
            c1.BackColor = tr.BackColor
            tr.BackColor = k
            tr1 = True
            tl1 = False
        End If
        If c1.Top < 3500 Then
            c1.Top = c1.Top + 50
        Else
            If br1 = False Then
                k = c1.BackColor
                c1.BackColor = br.BackColor
                br.BackColor = k
                br1 = True
                bl1 = False
            End If
            Timer1.Enabled = False
            Timer2.Enabled = True
        End If
    End If
End Sub

Private Sub Timer2_Timer()
    If c1.Left > 0 Then
        c1.Left = c1.Left - 50
    Else
        If bl1 = False Then
            k = c1.BackColor
            c1.BackColor = bl.BackColor
            bl.BackColor = k
            bl1 = True
            br1 = False
        End If
        If c1.Top > 0 Then
            c1.Top = c1.Top - 50
        Else
            If tl1 = False Then
                k = c1.BackColor
                c1.BackColor = tl.BackColor
                tl.BackColor = k
                tl1 = True
                tr1 = False
            End If
            Timer2.Enabled = False
            Timer1.Enabled = True
        End If
    End If
End Sub

Private Sub Timer3_Timer()
   g1.BackColor = QBColor(Rnd * 15)
End Sub


Download this snippet    Add to My Saved Code

Its Small Game for those who are interested in Colours. Comments

No comments have been posted about Its Small Game for those who are interested in Colours.. Why not be the first to post a comment about Its Small Game for those who are interested in Colours..

Post your comment

Subject:
Message:
0/1000 characters