multiplayermode = True
End Sub
Private Sub Layer_A_Click (Index As Integer)
playerdisplaylabel. Caption = ""
'Used For single player board selection or multiplayer your turn selection
Debug. Print "Layer A Click Turn Status " & MyTurn
Debug. Print "Layer A Multiplayer Mode Status " & multiplayermode
If multiplayermode = True And MyTurn = False Then 'Easy way to exit if not your turn
Exit Sub
End If
If Sq_Left Mod 2 = 1 Then 'check remainder of squares left divided by 2
If sw = True Then ' sets who goes first X or O
Layer_A (Index). Caption = "X"
Else
Layer_A (Index). Caption = "O"
Layer_A (Index). Enabled = False 'Sets selected square to not available
Player_A (Index) = 1
Computer_A (Index) = - Token
LoadPlayer
If multiplayermode = True And MyTurn = True Then 'checks for multiplayer and turn status
'This routine below packs message to send
'to other player to select the square chosen.
Dim dpmsg As DirectPlayMessage 'alot direct playmessage
Set dpmsg = dxplay. CreateMessage 'set and create the message
Call dpmsg. WriteLong (MSG_MOVE) 'pack message structure and identify type
Call dpmsg. WriteByte (Index) 'Packs case selection number to msgtype.
'This sends the pack message structure
Call dxplay. Send (MyPlayer, DPID_ALLPLAYERS, DPSEND_GUARANTEED, dpmsg)
If multiplayermode = True Then 'Sets routines to not your turn on multiplayer
Dim Y As Integer
Y = 0
For Y = 0 To 8
Layer_A (Y). MouseIcon = LoadResPicture ("nyt", vbResIcon)
Next Y
'Update Status displays
StatusBar1. SimpleText = "Game count is " & score & " " & opponentsname & ": " & opponentsscore & " | " & profilename & ": " & profilenamescore & " " & opponentsname & "'s Turn"
Out_Box. Caption = opponentsname & "'s Turn."
'Everything below until mod else statement is single player
If multiplayermode = False Then 'Sets X or O turn status on single player
If sw = True Then
StatusBar1. SimpleText = "New Game Initialized O's Turn"
StatusBar1. SimpleText = "New Game Initialized X's Turn"
Layer_A (Y). MouseIcon = LoadResPicture ("o", vbResIcon)
Layer_A (Y). MouseIcon = LoadResPicture ("x", vbResIcon)
Out_Box. Caption = "O's Turn"
Out_Box. Caption = "X's Turn"
'Mod else*********************************
Layer_A (Index). Enabled = False
Player_A (Index) = - Token
Computer_A (Index) = 1
If multiplayermode = True Then
If multiplayermode = False Then
LoadComputer
If multiplayermode = True And MyTurn = True Then
'Same as above packs message and sends move to other player
Dim dpmsg2 As DirectPlayMessage
Set dpmsg2 = dxplay. CreateMessage
Call dpmsg2. WriteLong (MSG_MOVE)
Call dpmsg2. WriteByte (Index)
Call dxplay. Send (MyPlayer, DPID_ALLPLAYERS, DPSEND_GUARANTEED, dpmsg2)
Sq_Left = Sq_Left - 1
EvalNextMove
MyTurn = False
Public Function layer_A_online (Index As Integer)
'This routine is called to mark sqares when remote computer
'sends a move made command.
'Same as above with some redundant routines removed
If Sq_Left Mod 2 = 1 Then
StatusBar1. SimpleText = "Game count is " & score & " " & opponentsname & ": " & opponentsscore & " | " & profilename & ": " & profilenamescore & " " & profilename & "'s Turn"
Out_Box. Caption = profilename & "'s Turn."
Страницы: 1, 2, 3, 4, 5