mumintrollet Posted May 31, 2018 Share Posted May 31, 2018 ive followed some tutorials on how to make a game with phaser. the very basic seems to be the 3 parts, "preload, create, update". so i made a game and its working. now i want to make this game multiplayer-playable, so i go to some tutorial for that and i immediately notice, theres no update function. instead theres this: Game.getCoordinates = function(layer,pointer){ Client.sendClick(pointer.worldX,pointer.worldY); }; Game.addNewPlayer = function(id,x,y){ Game.playerMap[id] = game.add.sprite(x,y,'sprite'); }; Game.movePlayer = function(id,x,y){ var player = Game.playerMap[id]; var distance = Phaser.Math.distance(player.x,player.y,x,y); var tween = game.add.tween(player); var duration = distance*10; tween.to({x:x,y:y}, duration); tween.start(); }; Game.removePlayer = function(id){ Game.playerMap[id].destroy(); delete Game.playerMap[id]; }; i googled on these functions like, "game.removeplayer" but didnt find anything. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.