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

SOLVED my gm_room is not working

Hello I am new to this and started the tutorial on space rocks using GML it was going good for a while but now im near the end and when I go from the starting room to the game room the code doesn't recognize the switch or the room itself so nothing happens when I enter the game room which makes the rest of the code null. Pls help.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Room changes not being recognized is something I haven't heard of in the 17 years I've been using GM, so I'll dare to claim that is most likely not what's happening...

What do you see in the game window when you change to the other room?
 

flyinian

Member
First Thought: Is the object/code that is meant to be used after the starting room marked as persistent?
Controller object: An object that has code that is used to control certain aspects of your game. I.E. Pause mechanics, global variables, enumerators. Pretty much an object that controls how the game works.
If you have a controller object(commonly named) in the starting room(commonly named: initialization room) and you need it to be used constantly while the game is played, it must be marked as persistent. This means that the controller object will exist through room changes.

Crude Example:

Controller Object marked as persistent and it exists in the initialization room.
The game is ran.
The game will run the initialization room(if its first in the "Room Order").
When the initialization room is ran, it'll create and execute the code in the objects that exist inside of it.
The Controller Object should now be created and it's code being executed along w/ it being persistent through rooms.
Room change happens.
Controller object will exist in the next room.

Hope this helps and is clear.

P.S. If you link the tutorial your following (If a video is paired w/ the space rock tutorial) w/ any time stamps that are relevant along w/ any relevant code, help may be more readily available for you.
 

flyinian

Member
how do I know if the starting room is marked as persistent
Not the starting room marked as persistent. It would be the object being marked as persistent.

I'm not entirely sure if you need/should do this for the space rocks tutorial. Edit: I think the first room no matter what will have the house Icon(Initialized first)
For the room: On the asset Browser. Look for "Quick Access" and then find "Room Order". Make sure your first room(initialization room) has that house Icon next to it.



For the Object: Find the object in the asset browser. Double click it. The popup that appears should be the object's settings. You'll see the "Name", "Sprite" & "Collision Mask" categories. Under the "Collision Mask" category you'll see check boxes with labels. Find the check box labeled as "Persistent". When found, check the check box. The object now should be persistent once its created.

Again, If you were to paste your code, tutorial video(if one exists), etc. we could help figure out what the problem is more accurately. I feel like the info I'm giving you may be doing more harm than good.
 
there is but since the room_goto is not working the events set up for the room such as spawning astroids and playing music aren't running because it doesn't identify the switch over to the game room
 

curato

Member
You may need to post your code. There has to be something different than the tutorial to make it not work as expected.
 

flyinian

Member
it was working but I broke it somehow and I can't figure out how
is there a way for me to share my project so you could check it out
You could give the source files but, I don't think that's necessary.

I believe its a persistence issue.

Goto the link I posted in my past post and double check everything.

obj_game must be marked as persistent and it must be placed in rm_game.

Since its a video tutorial. if all else fails. Re-watch the tutorial that is in question and double check your work.
 
Top