Home | Customize | Blog | Extras | Log In | Info
Manual | D&D icons | GML Parser | Archive | Iso City
Username: Password:  
About | Features | Directory | Banners | Contact

Designing Games with GameMaker
Designing Games with GameMaker

Advanced settings

There were two aspects in the settings tab that we have not yet discussed. First of all, there is a checkbox labeled Persistent. Normally, when you leave a room and return to the same room later, the room is reset to its initial settings. This is fine if you have a number of levels in your game but it is normally not what you want in for example an RPG. Here the room should be the way you left it the last time. Checking the box labeled Persistent will do exactly that. The room status will be remembered and when you return to it later, it will be exactly the same as you left it. Only when you restart the game will the room be reset. Actually, there is one exception to this. If you marked certain objects as being persistent, instances of this object will not stay in the room but move to the next room.

Secondly, there is a button labeled Creation code. Here you can type in a piece of code in GML (see later) that is executed when the room is created. This is useful to fill in certain variables for the room, create certain instances, etc. It is important to understand what exactly happens when you move to a particular room in the game.

  • First, in the current room (if any) all instances get a room-end event. Next the non-persistent instances are removed (no destroy event is generated!).
  • Next, for the new room the persistent instances from the previous room are added.
  • All new instances are created and their creation events are executed (if the room is not persistent or has not been visited before).
  • When this is the first room, for all instances the game-start event is generated.
  • Now the room creation code is executed.
  • Finally, all instances get a room-start event.

So, for example, the room-start events can use variables set by the creation code for the room and in the creation code you can refer to the instances (both new ones and persistent ones) in the room.

There is one further option. In the pop-up menu when you right click on an instance with the <Ctrl> key you can now indicate some creation code for the specific instance. This code is executed when the room is started, just before the creation event of the instance is executed. This is very useful to e.g. set certain parameters that are specific to the instance.

Search Search


Alternative versions Alternative versions

You can also read this manual on one single long page (± 1.5 mb)

Also available in: None

ZIP Download helpfile

Advertisement Advertisement

GameMaker Manual