How to update the position of a remote object?

Recommended Posts

Hi, I'm a new user and I do not know the rules of this forum.
However, let you understand, I first define the context. I'm developing a 
peer-to-peer game, using the "simple-peer" API, all based on the opponent's position (x, y).
My only issue concerns updating the remote sprite video so that I can update it using only
 using the moveToXY () function and if the tween do not work.
Positions are captured with the peer's "data" listener, saving them to an array position:

peer.on ('data', function (data) {
              positions = data.split("-");
               console.log (positions[0] + "-" + positions[1]);

In the update function I would instead use this feature:

this.tween = this.add.tween (opp) .to ({x: positions[0], y: positions[1]}, 1,Phaser.Easing.Linear.None, true); 

but unfortunately it does not work.
I tried to test the tween replacing positions at player.x and player.y, but it works.
How can I do? I am desperate.

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.


  • Recently Browsing   0 members

    No registered users viewing this page.