This function will create a new particle system on a given layer. You give the unique layer ID as returned by the function layer_create() or the name of the layer to use as a string - for example "instance_layer" - and then flag the system as being persistent or not. If the system is flagged as persistent then it will be persisted across all rooms after it has been created (and assigned a managed layer if the initial layer does not exist in subsequent rooms), but if persistence is not flagged, then the system will be automatically destroyed at the end of the room it was created in (this is the same as if you had called the function part_system_destroy and will also destroy any emitters associated with the system). The function will return a unique ID value for the particle system that should be used in all further function calls where you need to give a system ID.IMPORTANT! If you flag the particle system as persistent, then it (and any emitters assigned to it) will need to be cleaned up manually using the appropriate destroy functions when not in use, otherwise you risk a memory leak that will negatively impact your final game.
参数 描述 layer The layer ID value or string to assign the particle system to (can be any layer type) persistent Flag the particle system as persistent (set to true) or not (set to false)
Real (unique particle system ID value)
global.p_sys = part_system_create_layer("effects_layer", true);
The above code will create a new particle system on the given layer and flag it as persisting over subsequent rooms. The ID for the particle system is stored in a global scope variable for future reference.