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

"Teleporter"

I want the player to press a button whenever I reach the "teleporter" and I get to next room just fine, but I want it to be able to go back to the other room. However, I just go to the next room. I have a global variable called flipRoom which is supposed to check if you are in a "Negative" room but its not working. This is what the code looks like in Drag and DropBlackRoom-WhiteRoom - GameMaker Studio 2 2021-07-04 8_39_12 AM.png
Here is the GML preview if you prefer that:
BlackRoom-WhiteRoom - GameMaker Studio 2 2021-07-04 8_42_44 AM.png
 

TsukaYuriko

☄️
Forum Staff
Moderator
Is an instance of this object in the negative room? What happens when you try to go back? Try putting debug messages at key points of your code to check which parts of it execute and which don't.
 

TsukaYuriko

☄️
Forum Staff
Moderator
You could make the room to go to variable. If you want to do this via the GUI, add a variable of type Asset in the object's Variable Definitions. You'll then be able to select a room in the properties window of instances of this object that you place in the room. Finally, instead of going to the next room, go to a specific room, that room being the one stored in the variable you just created.
 
You know what, that would make sense. It is going to be a little bit a hard coding but it will be a little easier. My original plan was to make it so that you would step on the teleporter and it would teleport you back to whatever room you originally came out of depending on the room you are currently in. I think this idea will work since I want to do a "Campaign" map pack kinda thing where its 5 levels per section. I think this will be easier. Thanks!
 

TsukaYuriko

☄️
Forum Staff
Moderator
Instead of defining teleport locations via instance variables, you could also define the teleport target as a global variable in the room creation code. This only works if every room always has exactly one "negative" version, though.
 

gnysek

Member
My prediction is, that you have global.fliproom = false; in creation code of this "teleport" object, so it's get reset in new room.
 
Its fine. I have a solution for the problem. What I did was create two different game objects with the mechanics I want. I make a teleporter Pos and a Tele Neg. The Positive will take the player to the next room and the Negative will take you back to the previous room. The solution also created another problem. I want the player to be positioned on top of the teleporter after I moved to the next room. anyone know how to do that?
 
Top