it starts on this thread http://forum.shephertz.com/index.php/56/issues-with-snake-wars-tutorial?show=59#a59
i want to use the concept in the snake wars tutorial to limit the room for 2 players in the smiley shooter game
I tried some modifications in the AppWarpListener class, i'm following the concepts in here
http://appwarp.shephertz.com/game-development-center/Cocos2d-xna-multiplayer-tutorial/#how-does-the-integration-with-appwarp-work
first, the onConnectDone function: i put "WarpClient.getInstance().joinRoomInRange(1,1,true);" instead of joining a roomID
public function onConnectDone(res:int):void
{
if (res == ResultCode.success) {
WarpClient.getInstance().joinRoomInRange(1,1,true);
}
else if(res == ResultCode.api_not_found || res == ResultCode.auth_error){
_owner.updateStatus("Verify your api key and secret key");
}
else if(res == ResultCode.connection_error){
_owner.updateStatus("Network Error. Check your internet connectivity and retry.");
}
else{
_owner.updateStatus("Unknown Error");
}
}
then, on the onJoinRoomDone:
public function onJoinRoomDone(event:Room):void
{
if(event.result == ResultCode.success)
{
//point A
roomID = event.roomId;
WarpClient.getInstance().subscribeRoom(roomID);
_owner.updateStatus("Started! Use up/down arrows and click to shoot.")
} else if(event.result == ResultCode.resource_not_found)
{
//point B
WarpClient.getInstance().createRoom("room", "admin", 2, null);
trace(event.roomId);
_owner.updateStatus("Room join failed. Verify your room id." );
}
}
through tracing, I know that when I start the swf, it reaches point B but it seems it fails to do the createRoom function properly since the trace(event.roomId) gives out null
and when I create a second swf the same thing happened, and the two players arent connected
when I tried "WarpClient.getInstance().joinRoomInRange(0,1,true);" instead of (1,1,true);, it actually works!
(from tracing, i found out that it only reaches point A in the onJoinRoomDone function)
I can run multiple SWFs at the same time and whenever there's already 2 players on the room, the new swf will create a new room with only 2 player limit.
But I can't differentiate which one is first/second player in a room since in the game I'm creating right now I need to differentiate it