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.