game-makergame-maker-studio-2

Is it possible to return to a room in the state you left it, rather than being reset in GameMaker Studio 2?


Currently I'm trying to implement a way that the user can quickly switch to a room that displays the instructions/controls. Once they're done reading them, they should be able to return to the room they were previously in in the state that they left it. What currently happens when I return to the room is that it has be reset to how it started.

I'm not calling anything like room_restart() or game_restart(), I'm just using room_goto(num) to navigate between the game room and the instructions room.


Solution

  • An easy way around would be to mark your room as persistent (room_persistent = true) before transitioning to instructions room and unmark it after transitioning back.

    A more proper way would be to not transition the room at all, instead deactivating the game objects (instance_deactivate_all(true)) and then activating them again (instance_activate_all()) - just like you would for showing a pause menu.