SOLVED Changing position between rooms?

B4lcken

Member
Hello, I'm very new to Game Maker, like I just downloaded it. It's a school project and we have to use game maker.
So basically, I need to change the position between rooms, so it matches up? You get the idea. I come from the left side on one room, and enter a the right side in the new scene.

Here's my code:
GML:
if (x >= 1200) {
    if (room !=(room_first)) {
        room_goto_previous();
        if (room == FaktaIndenfor) {
            global.Mark.x = 10;
        }
    }
} else if (x < 0) {
    room_goto_next();
    if (room == FaktaUdenfor) {
        global.Mark.x = 1200;
    }
}
I switch rooms propperly, I just need to change the X value
 

Nidoking

Member
Is global.Mark the ID of an instance? Is that instance persistent? If you're creating a new instance in a new room, you'll have to set its position after the room transition.
 

B4lcken

Member
Is global.Mark the ID of an instance? Is that instance persistent? If you're creating a new instance in a new room, you'll have to set its position after the room transition.
No it's the same instance, it's the same object i dragged in.
 

Nidoking

Member
The same way you're doing now, by setting the x position. You just need to do it after the room transition. Either having a persistent instance or a global variable would let you store the intended x position, and you can grab it in the Room Start or Create event for the new instance.
 

B4lcken

Member
The same way you're doing now, by setting the x position. You just need to do it after the room transition. Either having a persistent instance or a global variable would let you store the intended x position, and you can grab it in the Room Start or Create event for the new instance.
Thank you so much! It is working now!
 
Top