Thelifeofpbion

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. I need help with creating objects in pixi In the backend I have a code running every 1000 millisecond, which passes the id, and x and y positions and I made a for that runs through the list of players. but when the first player comes in, it picks up the sprite "cat" which is a variable. then when the second player enters it also picks up the same variable, but as the first one already had it it becomes invisible. I need help, so that every id I pass in is for it to take an instance of "cat" and if I put the cat variable inside the for it gets creating several cat. const texture = PIXI.Texture.from('images/cat.png'); let cat = new Sprite(texture); const socket = io(); socket.on('newPositions',function(data){ // recebe o pacote 'newPosition' for(let i= 0;i < data.length; i++){ // fazendo um for do tamanho da data cat.x = data[i].x; cat.y = data[i].y; app.stage.addChild(cat); }