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.

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.

Converted from CHM to HTML with chm2web Pro 2.85 (unicode)