Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import playerio.*
- stop()
- //Connect and join the room
- var connection:Connection;
- var gameID:String = "real-time-interpolated-ibf9makikyjykif7yig"
- PlayerIO.connect(stage, gameID, "public", "User" + Math.floor(Math.random()*1000).toString(), "", handleConnect, function(){trace("connect error")} ); //This connects us to our game server
- function handleConnect(client:Client){ // Called on successful connection
- trace("Connected to server")
- client.multiplayer.createJoinRoom("test", "upper", false, {}, {}, handleJoin, function(error){trace(error)} ); //Makes us join or create the room "test"
- nextFrame();
- }
- //called when a user joins the room
- function handleJoin(conn:Connection){
- trace("joined")
- connection = conn
- //This will call gotMessage every time we receive any message
- connection.addMessageHandler("*",gotMessage);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement