Guest User

Untitled

a guest
Mar 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. function createShip(x,y,angle,ship){
  2. var s = game.add.sprite(x,y,ship);
  3. s.rotation = angle;
  4. s.anchor.setTo(0.5,0.5);
  5. return s;
  6. }
  7.  
  8.  
  9.  
  10. for(var i in data){
  11. if(others[i] == undefined && i != socket.id){
  12. var d = data[i];
  13. others[i] = createShip(d.x,d.y,d.angle,d.ship);
  14. }
  15. found[i] = true;
  16.  
  17. if(i != socket.id){
  18. others[i].x = data[i].x;
  19. others[i].y = data[i].y;
  20. others[i].rotation = data[i].angle;
  21. others[i].ship = data[i].ship;
  22. }
  23. }
  24.  
  25. game.physics.startSystem(Phaser.Physics.ARCADE);
  26. game.physics.arcade.enable(others);
  27.  
  28. game.physics.arcade.collide(others);
Add Comment
Please, Sign In to add comment