SHARE
TWEET

Untitled

a guest Apr 30th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package;
  2.  
  3. import flixel.FlxState;
  4. import io.colyseus.Client;
  5. import io.colyseus.Room;
  6.  
  7. class PlayState extends FlxState
  8. {
  9.     var client:Client;
  10.     var room:Room;
  11.  
  12.     override public function create():Void
  13.     {
  14.         super.create();
  15.  
  16.         trace("PlayState:create()");
  17.  
  18.         client = new Client("ws://0.0.0.0:2567");
  19.         client.onError = function (message){
  20.             trace("CLIENT ERROR: " + message);
  21.         }
  22.         room = client.join("my_room");
  23.  
  24.         client.onOpen = function() {
  25.             trace("CLIENT OPEN, id => " + client.id);
  26.         };
  27.  
  28.         client.onClose = function () {
  29.             trace("CLIENT CLOSE");
  30.         };
  31.  
  32.         room.onJoin = function() {
  33.             trace(client.id + " JOINED ROOM => " + room.name);
  34.         };
  35.     }
  36.  
  37.     override public function update(elapsed:Float):Void
  38.     {
  39.         super.update(elapsed);
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top