Search Unity

Platforms in multiplayer

Discussion in '2D' started by madks13, Feb 25, 2017.

  1. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    Hello,

    i've got a bit of a logistics problem :

    I want to add platforms in my game. The platforms behave as following :
    - Player can pass trough them from below going up
    - Player can't pass trough them falling on them from above
    - Player can pass trough them if pressing down button and jump button at same time

    I've checked the 2D example projects and the forums and found a few things that work....in single player.

    The most recommended way of doing this is checking on collision if the collider is on a platform, and if yes, and the context is right, deactivate the collider until the player goes trough.

    This might work in single player, but in multiplayer it might not. I'm thinking of the situation where 2 players are on the same platform and either another player jumps up on the platform, or one of the 2 players tries to jump down from the platform. How would you manage this situation?
     
  2. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    change the player (make new physic layer, which can not react with platform and switch player to this layer for falling time)
     
  3. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    Nice solution The-Britain. However given that my platforms can be set up as stairs (one right below the other), your solution seems to not be able to handle that, unless i'm mistaken. The same applies to the solution given by vakabaka.
     
  4. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    Yes, not mentionning that is my fault. However it's not Mario like, more Terraria/Starbound like where the players can place those platforms wherever they want, even if that is one under the other.
     
  5. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    I see, will try that The-Britain. Thanks for the explanation.