1

I am currently learning game maker. I have made a small simple 2d top down hack and slash game from different tutorials online. I have added a second player using 360 controller and started creating new levels. The issue I am having is moving both players to a new room. I have collision on an object door that checks if a player touches the door then moves them to a new room. However when the player moves rooms the other player does not move with them to the same location.

///door object collision

if (room_exists (other.new_room))
{
    room_goto(other.new_room);
    x = other.newx;
    y = other.newy;

}


///creation code on the door in the map 

new_room = rm2;

newx = 64;
newy = 34;

is there a way to assign obj_player2 to the new room as well using the same location?

1 Answers1

0

I assume both player objects are persistent and this is the player 1's collision event.

You are only assigning the new position to player 1, simply do the same for player 2.

if (room_exists (other.new_room))
{
    x = other.newx;
    y = other.newy;

    obj_player2.x = other.newx;
    obj_player2.y = other.newy;
}
Kake_Fisk
  • 1,107
  • 11
  • 22