VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Just a little tic tac toe game (my first vb encounter)

by J. Tesselhoff (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 25th May 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Just a little tic tac toe game (my first vb encounter)

Rate Just a little tic tac toe game (my first vb encounter)





ScoreEen = 0
ScoreTwee = 0



SpelerEen = True
SpelerTwee = False

Label2.ForeColor = &HC000&     'groen
Label3.ForeColor = &HFF&       'rood

lblScore(1).Caption = ScoreEen
lblScore(2).Caption = ScoreTwee

End Sub

Private Sub reset()

For x = 0 To 8
    lblSpel(x).Caption = ""
Next x


End Sub


Private Sub lblSpel_Click(Index As Integer)
     
Vak = Index

    If SpelerEen = True And lblSpel(Index).Caption <> "O" Then
        SpelerEenAanZet
    ElseIf SpelerTwee = True And lblSpel(Index).Caption <> "X" Then
        SpelerTweeAanZet
    End If
    
       
End Sub
Private Sub SpelerEenAanZet()
    lblSpel(Vak).Caption = "X"
        
    If lblSpel(0).Caption = "X" And lblSpel(1).Caption = "X" And lblSpel(2).Caption = "X" Or _
       lblSpel(3).Caption = "X" And lblSpel(4).Caption = "X" And lblSpel(5).Caption = "X" Or _
       lblSpel(6).Caption = "X" And lblSpel(7).Caption = "X" And lblSpel(8).Caption = "X" Or _
       lblSpel(0).Caption = "X" And lblSpel(3).Caption = "X" And lblSpel(6).Caption = "X" Or _
       lblSpel(1).Caption = "X" And lblSpel(4).Caption = "X" And lblSpel(7).Caption = "X" Or _
       lblSpel(2).Caption = "X" And lblSpel(5).Caption = "X" And lblSpel(8).Caption = "X" Or _
       lblSpel(0).Caption = "X" And lblSpel(4).Caption = "X" And lblSpel(8).Caption = "X" Or _
       lblSpel(2).Caption = "X" And lblSpel(4).Caption = "X" And lblSpel(6).Caption = "X" Then WinnaarEen
       

    SpelerEen = False
    SpelerTwee = True
    
    Label3.ForeColor = &HC000&     'groen
    Label2.ForeColor = &HFF&       'rood

    
    
    
End Sub

Private Sub SpelerTweeAanZet()
    lblSpel(Vak).Caption = "O"
    
    If lblSpel(0).Caption = "O" And lblSpel(1).Caption = "O" And lblSpel(2).Caption = "O" Or _
       lblSpel(3).Caption = "O" And lblSpel(4).Caption = "O" And lblSpel(5).Caption = "O" Or _
       lblSpel(6).Caption = "O" And lblSpel(7).Caption = "O" And lblSpel(8).Caption = "O" Or _
       lblSpel(0).Caption = "O" And lblSpel(3).Caption = "O" And lblSpel(6).Caption = "O" Or _
       lblSpel(1).Caption = "O" And lblSpel(4).Caption = "O" And lblSpel(7).Caption = "O" Or _
       lblSpel(2).Caption = "O" And lblSpel(5).Caption = "O" And lblSpel(8).Caption = "O" Or _
       lblSpel(0).Caption = "O" And lblSpel(4).Caption = "O" And lblSpel(8).Caption = "O" Or _
       lblSpel(2).Caption = "O" And lblSpel(4).Caption = "O" And lblSpel(6).Caption = "O" Then WinnaarTwee
    
    SpelerEen = True
    SpelerTwee = False
    
    Label2.ForeColor = &HC000&     'groen
    Label3.ForeColor = &HFF&       'rood

    
End Sub

Private Sub WinnaarEen()

Static ScoreEen As Integer

ScoreEen = ScoreEen + 1

MsgBox "Speler 1 wint!"
         
lblScore(1).Caption = ScoreEen


End Sub

Private Sub WinnaarTwee()

Static ScoreTwee As Integer

ScoreTwee = ScoreTwee + 1

MsgBox "Speler 2 wint!"

lblScore(2).Caption = ScoreTwee

End Sub


Download this snippet    Add to My Saved Code

Just a little tic tac toe game (my first vb encounter) Comments

No comments have been posted about Just a little tic tac toe game (my first vb encounter). Why not be the first to post a comment about Just a little tic tac toe game (my first vb encounter).

Post your comment

Subject:
Message:
0/1000 characters