Greating game on visual basic with multiplayer system
Case 1
Call MainBoard. layer_A_online (1)
Case 2
Call MainBoard. layer_A_online (2)
Case 3
Call MainBoard. layer_A_online (3)
Case 4
Call MainBoard. layer_A_online (4)
Case 5
Call MainBoard. layer_A_online (5)
Case 6
Call MainBoard. layer_A_online (6)
Case 7
Call MainBoard. layer_A_online (7)
Case 8
Call MainBoard. layer_A_online (8)
End Select
MyTurn = True
Case MSG_CHAT_ON 'Handles Turn chat on off
Call MainBoard. chatswitch
Case MSG_XORO 'Selects who goes first X or O
Dim thing As Byte
thing = dpmsg. ReadByte
If thing = 1 Then
Call MainBoard. x_Click
End If
If thing = 2 Then
Call MainBoard. o_Click
End If
Case MSG_RESTART 'handles input for restart
multiplayermode = True
MainBoard. playerdisplaylabel. Caption = opponentsname & " has restarted the game."
If sw = True Then
MyTurn = False
Else
MyTurn = True
End If
Call MainBoard. restart_Click
Case MSG_CHAT 'Handles Chat String input
Dim chatin As String
chatin = dpmsg. ReadString ()
If MainBoard. chatlabel. Text = "" Then
MainBoard. chatlabel. Text = opponentsname & ": " & chatin
Else
MainBoard. chatlabel. Text = MainBoard. chatlabel. Text & vbCrLf & opponentsname & ": " & chatin
End If
Case MSG_STOP 'Handles player disconnected.
MsgBox opponentsname & " has left the game. ", vbOKOnly, "Tic Tac Oops"
MainBoard. mnudisconnect. Enabled = False
MainBoard. newgame. Enabled = True
MainBoard. hostagame. Enabled = True
MainBoard. joinagame. Enabled = True
multiplayermode = False
usermode = "host"
Call CloseDownDPlay
Unload Connect
onconnect = False
End Select
End If
Loop
Exit Sub
' Error handlers
MSGERROR:
MsgBox ("Error reading message. ")
CloseDownDPlay
End
NOMESSAGE:
Exit Sub
End Sub
INTERFACE

