How do I Have each player have its own camera in multiplayer?

  • I'm trying to create a game similar to moomoo.io and I want each player to have its own camera.

  • If it's online multiplayer (which moomoo.io seems to be) then each game client (i.e. the game running on each individual person's machine) will just need its own camera that tracks the individual player.

    You could think of it like this:

    - The current player has a sprite object that represents them.

    - All other players from the perspective of the current player, should have their own instance of a separate sprite object type called otherPlayer.

    - You'll need multiplayer logic to handle users joining and disconnecting a game server. You'll want to propagate the join and disconnect events to all other players.

    - Then in your game, you'll listen for new or disconnecting players and create or destroy 'otherPlayer' instances as necessary.

    - One trick, have a unique player ID for each player, store that as a variable on each instance of otherPlayer.

    Ideally they'd probably all be the same object type but for initial development it might be easier to make them separate, i.e. "currentPlayer" and "otherPlayer".

    I hope that points you in the right direction. If none of that makes sense I'd recommend looking up tutorials on the multiplayer object in Construct's docs.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks it worked! hope You have a good day.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)