How do I make a sprite visible only for a peer?

0 favourites
  • 6 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • Hey!

    I have read all the multiplayer tutorials and when you let it sink in the puzzle pieces fall slowly into place.

    But one thing that didn't fall into place for me is if it is possible to have a sprite visible only for one person.

    In this example:

    Each player has a sprite that only them can see and not the others. To be more specific it's a shadow behind the player that hides what is behind them (like a dead angle).

    Thanks in advance for any replies.

  • Ashley do you have any answer to this por favor?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've tried to use the expression if Peerid is not equal to multiplayer.myID then destroy, but it seems to destroy the sprites for everyone...

    So I'm really stuck here.

  • 'Destroy shadow' destroys all shadows because you haven't picked the right/wrong one yet. You have only checked for a condition which is True, and it destroys (all).

    Instead of that condition, you should use System -> Pick by comparison -> Select shadow and add that condition (peerid =/= myID). See if that works.

    And if that doesn't work for some reason, try setting ALL of the shadows to Invisible. Then: System -> Pick by Overlapping point -> Overlapping with player -> Set Visible

  • Greetings rolandzarmy

    I'm Eleanor, a users of construct for many years,

    You do not need to sync everything, use your knowledge of events to create your shadow like you would in a non multiplayer game and make sure your picking is right.

    Best of luck developing your game,

    Eleanor Jacques-Morel

  • Thank you for your reply EL Constructorr and eleanorjmorel !

    Both solutions are great. I did as Eleanor suggested to avoid syncing too many objects. In my common group I just use the "Shadow" sprite I made on the Game Layout, and put it to the player position and angle every tick.

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