Heron Posted April 30, 2016 Share Posted April 30, 2016 EN: the name of the player has a delay to follow the sprite, someone could help me?, see the video to know better PT-BR: o nome do player tem um delay ao acompanhar a sprite, alguém poderia me ajudar?, veja o video para entender melhor Sources attached. Game.js players.js Rec_001.avi Link to comment Share on other sites More sharing options...
Arcanorum Posted April 30, 2016 Share Posted April 30, 2016 Same problem: Your problem is in Game.js: if(game.player.deltaX !== 0 || game.player.deltaY !== 0){ game.player.name.x = game.player.x; game.player.name.y = game.player.y - 50; this.socket.emit("movePlayer", {x: game.player.x, y: game.player.y}); } You should not be moving objects around by manually setting the x/y values in this situation. You should attach the name to the player as a child. In player.js, add player.addChild(player.name); after creating the name text object. Also, I wouldn't recommend generating your player ID on the client. Make it on the server when the client connects then send it to them. var PlayerID = Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000; Just looks wrong... Heron 1 Link to comment Share on other sites More sharing options...
Heron Posted May 1, 2016 Author Share Posted May 1, 2016 Problem with the ID is a provisional method dont worry about this, thank you for the answer Link to comment Share on other sites More sharing options...
Recommended Posts