• 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!

Warp to a location within same room

I see a lot of tutorials about warping to other rooms, but what if you want to warp to a different spot in the same room? How would you go about that? The simple code I'm familiar with is:

if room=room1{
room_goto(room1)
x=1315
y=107
}

As you can see, I am trying to warp to different x/y coordinates within the room. How is that done? I'm new to programming and GML btw, so be kind, please.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Remove the room_goto part and you will merely change the coordinates of the calling instance... which is a different way of saying "warp to a different location in the same room". ;)
 

TsukaYuriko

☄️
Forum Staff
Moderator
For future reference, your PC will not explode (maybe) if you try out code regardless of whether you know if it's correct or not. Sometimes, you'll find that you had the right idea and that it works exactly the way you'd want it to. Don't be afraid to just try out things - that's how you learn. ;)
 
Top