breackzin's Forum Posts

  • I am getting java errors when the host is joining as a second player.

  • Help with what exactly?

    Gimme some direction.

    I got everything added on the container object from rex, then created/spawned it on the new layout, but it did not saved the positions of the objects and everything was overlapping each other.

  • mindfaQ tried all day long without success... could you help me?

  • Looks like that right now the best solution for a custom shape is to have more than one sprite pinned in certain points on a dorso, deck.

    I want to draw a custom shape in a single sprite. Like editing a ship on a layout and have it as a single sprite on the next.

    Any idea?

  • Done it, thanks. Also boolean variable solved lots of issues.

  • It is bound to my mouse, then i click and it have to fill a place on the grid. How?

  • LittleStain and zatyka

    My most sincere thanks.

  • LittleStain

    like 8, all of them inside the object.

    About the distance, the problem is returning in with the closest.

  • Thank you for coming.

    I wanna pin my player on the closest imagepoint of an object.

    Top down game where every object rotates.

    I have tried offset position without success, but now i am willing to use: imagepointX(N.)-player.X, take the smallest X.

    The problem is, i don't know how to build it up on the events...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Really Nice!

  • rexrainbow, I will be looking your server again this October, trying to understand what is so wrong with my own.

    Could you tell me what yours "console.log('app listening on http://' + addr.address + ':' + addr.port);" show to you in your logs?

    My server works on foreman and I manage to keep my previews connected on it locally, but once I produce the server package and push it to heroku, It logs "app listening on http://0.0.0.0:30801" and I can not manage to connect on it.

    Also, some "code=H12 desc="Request timeout"" appears on my logs.

  • Tried it myself without success, so here I am.

    <font color=red><font size="5">U$ 5,00</font></font>

    for the first to deliver a related code(containing the same info present in this one) hosted and working online:

    var entities = [], count = 0;

    var port = process.env.VCAP_APP_PORT || 5000;

    var io = require("socket.io").listen(port);

    var usernames = {};

    var chat = {};

    var rooms = ['room1','room2','room3'];

    var INITIAL_X = 6000;

    var INITIAL_Y = 5000;

    var INITIAL_VEL_X = 0;

    var INITIAL_VEL_Y = 0;

    // assuming io is the Socket.IO server object

    io.configure(function () {

    io.set("transports", ["xhr-polling"]);

    io.set("polling duration", 10);

    io.set('log level', 1);

    console.log("The listening port is:" + port)

    });

    io.sockets.on("connection", function (socket) {

        var myNumber = count++;

        //assign number    

        var mySelf = entities[myNumber] = [myNumber, INITIAL_X, INITIAL_Y, INITIAL_VEL_X, INITIAL_VEL_Y, usernames];

        //Send the initial position and ID to connecting player

    console.log(myNumber + ' sent: ' + 'I,' + mySelf[0] + ',' + mySelf[1] + ',' + mySelf[2]);

        socket.send('I,' + mySelf[0] + ',' + mySelf[1] + ',' + mySelf[2]);

        // Join room

         socket.join('room1');

         // store the room name in the socket session for this client

         socket.room = 'room1';

         //Send to conencting client the current state of all the other players

        for (var entity_idx = 0; entity_idx < entities.length; entity_idx++) { //send initial update

            if (entity_idx != myNumber) {

                entity = entities[entity_idx];

                if (typeof (entity) != "undefined" && entity != null) {

                   console.log(myNumber + ' sent: C for ' + entity_idx);

                   socket.send('C,' + entity[0] + ',' + entity[1] + ',' + entity[2]); //send the client that just connected the position of all the other clients

                }   

            }

        }

        //create new entity in all clients    

        socket.broadcast.emit("message",'C,' + mySelf[0] + ',' + mySelf[1] + ',' + mySelf[2]);

        socket.on("message", function (data) {

           

            //if (myNumber == 0)

            //    console.log(myNumber + ' sent: ' +data);

            var new_data = data.split(',');

            if (new_data[0] == 'UM') {

                mySelf[1] = new_data[1];

                mySelf[2] = new_data[2];

                mySelf[3] = new_data[3];

                mySelf[4] = new_data[4];

                mySelf[5] = new_data[5];

                mySelf[6] = new_data[6];

                mySelf[7] = new_data[7];

                //Update all the other clients about my update

                socket.broadcast.emit("message",

                   'UM,' + mySelf[0] + ',' + mySelf[1] + ',' + mySelf[2] + ',' + mySelf[3] + ',' + mySelf[4] + ',' + mySelf[5] + ',' + mySelf[6] + ',' + mySelf[7]);

            }

            else if (new_data[0] == 'adduser') { // a adduser message

                var usernames = {};

                usernames[0] = new_data[1];

                console.log("message",'adduser,' + mySelf[0] + ',' + usernames[0]);

                socket.broadcast.emit("message",

                   'adduser,' + mySelf[0] + ',' + usernames[0]);

                   }

              else if (new_data[0] == 'chat') { // a chat message

                var chat = {};

                chat[0] = new_data[1];

                console.log("message",'chat,' + mySelf[0] + ',' + chat[0]);

                socket.broadcast.emit("message",

                   'chat,' + mySelf[0] + ',' + chat[0]);

                   }<font size="5">...</font>

           

  • Bumping for a Assistance!

  • vladoss

    broadcast Sends the message or event to every connected user in the current namespace, except to your self.

    It is useful to get off some "picks" from your client code.

    send, sends to everyone but does not support custom events.

    emit, does support.

    Also, my problem is here: scirra.com/forum/socketio-and-heroku_topic71952.html