Sign in to follow this  

Name following the player with delay

Recommended Posts

Same problem: 

Your problem is in Game.js:

if(game.player.deltaX !== 0 || game.player.deltaY !== 0){ = game.player.x; = 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(; 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...

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.