Лабораторная работа: Greating game on visual basic with multiplayer system

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"

End If

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)

End If

If multiplayermode = True Then 'Sets routines to not your turn on multiplayer

Dim Y As Integer

К-во Просмотров: 852
Бесплатно скачать Лабораторная работа: Greating game on visual basic with multiplayer system