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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.