Game Development Reference
In-Depth Information
The NewJigsawGameScreen class
It is optional to subclass this for this game, however, we need to tell the Pulse server
the specific properties of the game room, such as whether its turn-based, has a
maximum of two players per room, and so on.
protected override function createNewGameRoom():void {
// Create the new Game room object
var room:GameRoomClient = new GameRoomClient();
// Set the name of the room from what is entered
// in the text field
room.setRoomName(m_ti.text);
// Limit maximum players that can
// enter the room to three
room.setMaxPlayerCount(3);
// Let players join the game
// even after it is started
room.setRoomType(GameConstants.ROOM_ALLOW_POST_START);
// set the player to be in ready
// state as soon as they enter the room
room.setAutoReady(1);
// Send a request to the server
// to create the game room
PulseGame.getInstance().
getGameClient().createGameRoom(room);
}
The new game screen has to be customized only for the purpose of defining the kind
of room that is needed for the game. The previous code is specific to the multiplayer
jigsaw game. The code creates a new room object instance, specifies the player to be
automatically set to ready when they join the room, sets up the room name for others
to see in the lobby, allows a maximum of three players into the room, specifies that
the room is turn-based, and finally requests the server to create the room. We also set
the room type so that new players may join the game midway. Once created on the
server, the room will appear in the lobby screen for other
players to join.
 
Search WWH ::




Custom Search