GMS 2.3+ Trying to make one way platforms work with multiple players.


Used Shaun Spalding's code, but it only works with one player. Can't figure out a way of doing it so it works with two players.

current code:
if (instance_exists(oPlayer1))
    if round (oPlayer1.y + (oPlayer1.sprite_height/2) > y + 1)
        mask_index = -1;
        mask_index = sPlatform;


It's just not going to work that way. You'll have to handle the collision of the players separately and determine whether they're jumping up through the platform or falling onto it.


Used Shaun Spalding's code, but it only works with one player.
That tutorial should be deleted. It's a really bad way to do one way platforms, as you've discovered the problem. Nothing else can stand on the platform while jumping through it.

Essentially these are the rules for coding one way platforms.
1/ Have a solid object and a platform object, and make both of them children of another parent object called o_solid_par.
2/ All collision checks should be performed against o_solid_par.
3/ BUT if the instances vertical speed is less than 0, collisions with o_platforms are ignored.

If you are really new to Gamemaker, there are other tutorials around that show better ways than Shaun's method, so just look around, as it might be hard to take what I've written above and convert that to working code.
Maybe make a list that keeps track of instance ids that have already passed through and on the players collision with the platform check that its not on the list