Player Object Position After Room Transition [SOLVED]

reizzar

Member
Hello, hello!
Fairly new to the GMS universe, but learning and loving every minute of it!

I am working on a platform style game and having a bit of trouble with where my player object ends up after a room transition! I followed along with Shaun Spalding's GMS2 "Room Transitions using Sequence" on YT and it works perfectly, however, my player character seems to get dropped in to Room 2 at the exit point of Room 1 -- IE, all the way at the other end of the screen, opposite where I have the transition tile set. (This was also happening with another room transition I was trying earlier where I defined specific X/Y coordinates... so I'm not sure what I'm missing!)

Hopefully a visual can help!

Here is Room 1 and where I have the transition set:
Room1.JPG

And here's Room 2, (left side of screen is where player should be coming in, but instead... comes in aaalllllll the way over there ------>):
room2.JPG

Any pointers leading in the right direction would be wonderful! :)
 

Slyddar

Member
I'm not sure how Shaun handles it, but essentially the logic is always the same. Basically once you have used a transition, you need to set the player to the position in the new room that you want them to start in. This could be set in each rooms creation code, or be the coordinates of some non visible o_start object you place in the new room, or be pulled from some data set which stores the position based on the room. However that is done, that part is not happening for you. Find out where that is happening and see if you are setting it correctly for the player when they move to the new room.

Also you can try using the debugger which will pause the code and let you step through it to see what is happening. (place a breakpoint on any line using F9, and run with F6. Shift-F11 will step through the code, and F5 will continue the game)
 

reizzar

Member
I'm not sure how Shaun handles it, but essentially the logic is always the same. Basically once you have used a transition, you need to set the player to the position in the new room that you want them to start in. This could be set in each rooms creation code, or be the coordinates of some non visible o_start object you place in the new room, or be pulled from some data set which stores the position based on the room. However that is done, that part is not happening for you. Find out where that is happening and see if you are setting it correctly for the player when they move to the new room.

Also you can try using the debugger which will pause the code and let you step through it to see what is happening. (place a breakpoint on any line using F9, and run with F6. Shift-F11 will step through the code, and F5 will continue the game)
Thanks, Sly! I'll give that a go in the morning with some rested brain energy.
I figured it had something to do with x and y coordinates of the player, but wasn't sure exactly where I should be telling it to do so!
 

reizzar

Member
Fixed the issue by adding a spawn point, so when you hit the door it would spawn you on top of an invisible object at specified coordinates! Yay. ^_^
 
Top