ClientController()

new ClientController()

a small wrapper class for the net controller that just fixes up some things to make it work for the client
basically just change the way data is sent and prepared

Members

conn

the connection to the host

hostId

the id of the host's peer

netPlayers

players not on the local machine
dictionary with keys equal to the client's peer id

peerId

the id of the client's peer

player

the player on the local machine

self

the client's peer

Methods

onStartGameData(startGame)

Parameters:
Name Type Description
startGame *

unused var

Fires:
  • event:startGame;

preprocessData(data, conn)

a function that will preprocess the data for onData.
this adds the field .id equal to the host's id or the sender id

Parameters:
Name Type Description
data

the data that was sent

conn

the connection that is sending the data

sendPlayerInfo()

send's the user's player info to the host
used to initialize them as a player