Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- import flixel.FlxState;
- import io.colyseus.Client;
- import io.colyseus.Room;
- class PlayState extends FlxState
- {
- var client:Client;
- var room:Room;
- override public function create():Void
- {
- super.create();
- trace("PlayState:create()");
- client = new Client("ws://0.0.0.0:2567");
- client.onError = function (message){
- trace("CLIENT ERROR: " + message);
- }
- room = client.join("my_room");
- client.onOpen = function() {
- trace("CLIENT OPEN, id => " + client.id);
- };
- client.onClose = function () {
- trace("CLIENT CLOSE");
- };
- room.onJoin = function() {
- trace(client.id + " JOINED ROOM => " + room.name);
- };
- }
- override public function update(elapsed:Float):Void
- {
- super.update(elapsed);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement