• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Help with room changing and player position?

H

Hudsonius

Guest
So I initially made it so that when my character collided with the door object, it would go to the next room, and then to the go to x and y points I wanted to appear at. The method I used was inefficient for saving and loading, and a pain to use. So I created a object to define where the start of the room was, where the end was, and what the room number was.
I put this in the create event:
Code:
if room = (room_name)
{
    roomnumber = (room number)
    roomstartx = (starting point x)
    roomstarty = (starting point y)
    roomendx = (ending point x)
    roomendy = (ending point y)
}
Then put it in every room. I made sure to say to go to the next room before saying where to set the start and end and to send my player there. However, whenever my player loads in the next room, he is far below the intended area (out of the map). I tried making the object persistent and changing the event to room start but that didn't work either. Any help or better way to do this?

Thanks in advance.
 
Can you post the real code instead of (room number), (starting point x), etc? Also, you should use == for comparisons, not the assignment =. It's not breaking your game, but it's far better coding practice (just because GM lets you get away with something, doesn't necessarily mean you should).
 
H

Hudsonius

Guest
From reading your code are you setting the player position in the room start event with this informaton? Please post any code in the player object.

Got ninja'd by @RefresherTowel. :p
I'm so dumb, before I put my code I realized my problem, the "if room =" statement always referred to the same room. It's working now, thanks for replying, sorry!
 
Top