diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Particles/Particle_Emitters/part_emitter_destroy.htm b/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Particles/Particle_Emitters/part_emitter_destroy.htm index c4c31cf71..2f1c7dd1f 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Particles/Particle_Emitters/part_emitter_destroy.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Drawing/Particles/Particle_Emitters/part_emitter_destroy.htm @@ -4,7 +4,7 @@
This function will remove the specified emitter from the given system and clear it from memory (this will also stop any particles from being produced by the given emitter, but it does NOT remove them from the room). This function should always be called when the given emitter is no longer needed for the system to prevent memory leaks and errors.
+This function removes the specified emitter from the given particle system and clears it from memory.
+This will also stop any particles from being produced by the given emitter. Existing particles created by this emitter are not removed from the particle system.
+This function should always be called when the given emitter is no longer needed for the system to prevent memory leaks and errors.
+
part_emitter_destroy( ps, ind );
+part_emitter_destroy( ps, ind );
ps | -Particle System ID | +Particle System Instance | The particle system to destroy the emitter from. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ind | -Particle Emitter ID | +Particle Emitter ID | The index of the emitter to destroy. |
Argument | Type | +|||
---|---|---|---|---|
Argument | +Type | Description | -||
ps | + | ps | +Particle System Instance | The particle system to destroy all emitters from. | -
+
N/A
if (lives == 0)
+
if (lives == 0)
{
part_emitter_destroy_all(global.Sname);
room_goto(rm_Menu);
}
The above code checks the built in global variable "lives" and if it is 0, it destroys all particle emitters and then changes room.
-+
The above code checks the built-in global variable lives and if it is 0, it destroys all particle emitters and then changes room.
Before you can create particles you need to create a particle system. This is a "container" where you place your particles and emitters (if you need them) ready for use, and you can put as many or as few particles into any one system as you think necessary, and you can have as many systems as you think necessary too. However, it is always better to keep this number as small as possible due to the fact that each system, emitter and particle takes up memory and having too many of them may slow your game down or cause problems. For example, if you need some effects to appear above instances, and other effects to appear beneath instances, you would create two systems and set their depths to get the desired effect, with all particles that are added to each system being drawn at the depth you specify.
+Before you can create particles you need to create a particle system. This is a "container" where you place your particles and emitters (if you need them) ready for use, and you can put as many or as few particles into any one system as you think necessary, and you can have as many systems as you think necessary too. However, it is always better to keep this number as small as possible due to the fact that each system, emitter and particle takes up memory and having too many of them may slow your game down or cause problems. For example, if you need some effects to appear above instances, and other effects to appear below instances, you would create two systems and set their depths to get the desired effect, with all particles that are added to each system being drawn at the depth you specify.
Since a particle system is a dynamically created resource, you must create it and store the returned index in a variable to reference the system in all further function calls, and it is very important that you also destroy the system when it is no longer needed or else you will have a memory leak that will slow down and eventually crash your game. It is also worth noting that particle systems will live on forever after they are created, even if the index is no longer stored. So even if you change room or restart the game, the systems and the particles will remain, and be visible, in all further rooms so you better make sure you destroy them once you no longer need them.
With this function you can clear all the particles currently created by the system from the room. It does not reset or remove the particle types themselves, just their visual representation, and if you have any object streaming particles from an emitter, these particles disappear but will begin to appear again the next step after calling this code.
--
part_particles_clear(ind);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system. | -
-
N/A
--
if (lives <= 0)
-
- {
-
- part_particles_clear(global.Sname);
-
- room_goto(rm_intro);
-
- }
The above code will check the value of the variable "lives" and if it is equal to 0, it clears all particles from the system and then changes room.
--
-
-
This function clears all particles currently created by the system from the room.
+It does not reset or remove the particle types themselves, just their visual representation, and if you have any object streaming particles from an emitter, these particles disappear but will begin to appear again the next step after calling this code.
++
part_particles_clear(ind);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system. | +
+
N/A
++
if (lives <= 0)
+ {
+ part_particles_clear(global.Sname);
+ room_goto(rm_intro);
+ }
The above code will check the value of the variable lives and if it is equal to 0, it clears all particles from the system and then changes room.
++
+
With this function you can check to see if a particle system currently has any particles created in the room, and it will return the number of them too.
--
part_particles_count(ind);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system. | -
-
Real
--
if (part_particles_count(Sname) == 0)
-
- {
-
- part_system_destroy(Sname);
-
- instance_destroy();
-
- }
The above code will check the number of particles in the local particle system indexed in the variable "Sname" and if there are none, it will destroy the system and then the instance.
--
-
-
This function returns the number of particles that currently exist in the given particle system.
++
part_particles_count(ind);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system. | +
+
+
if (part_particles_count(Sname) == 0)
+ {
+ part_system_destroy(Sname);
+ instance_destroy();
+ }
The above code will check the number of particles in the local particle system indexed in the variable Sname and if there are none, it will destroy the system and then the instance.
++
+
This function is ideal for those effects that do not require any of the functionality offered by particle emitters (for example, to create smoke from a missile, or a simple explosion effect) as it permits you to quickly and easily create particles at any position in the game room. Note that you must have created the particle system and the particle type previously for this function to be used.
--
part_particles_create(ind, x, y, parttype, number);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system. | -
x | -Real | -The x coordinate of where to create the particles. | -
y | -Real | -The y coordinate of where to create the particles. | -
parttype | -Particle Type ID | -The index (type) of the particles to be created. | -
number | -Real | -The number of particles to create. | -
-
N/A
--
if (mouse_check_button(mb_left))
-
- {
-
- part_particles_create(sname, mouse_x, mouse_y, p_CursorEffect, 5);
-
- }
The above code checks for the mouse button being pressed and if it returns true it generates 5 particles at the mouse position.
--
-
-
This function permits you to quickly and easily create particles at any position in a particle system.
+It is ideal for those effects that do not require any of the functionality offered by Particle Emitters (for example, to create smoke from a missile, or a simple explosion effect).
+You must have created the particle system and the particle type previously for this function to be used.
++
part_particles_create(ind, x, y, parttype, number);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system. | +
x | +Real | +The x coordinate of where to create the particles. | +
y | +Real | +The y coordinate of where to create the particles. | +
parttype | +Particle Type ID | +The index (type) of the particles to be created. | +
number | +Real | +The number of particles to create. | +
+
N/A
++
if (mouse_check_button(mb_left))
+ {
+ part_particles_create(sname, mouse_x, mouse_y, p_CursorEffect, 5);
+ }
The above code checks for the left mouse button being pressed and if it returns true it generates 5 particles at the mouse position.
++
+
This function is ideal for those effects that do not require any of the functionality offered by particle emitters (for example, to create smoke from a missile, or a simple explosion effect) as it permits you to quickly and easily create particles at any position in the game room. You can also colour the particles "on the fly" as they are created with this function, and this colour will over-ride the predefined colour of the particle, but it does not blend this colour over the particles lifetime. Note that you must have created the particle system and the particle type previously for this function to be used.
--
part_particles_create_colour(ind, x, y, parttype, colour, number);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system. | -
x | -Real | -The x coordinate of where to create the particles. | -
y | -Real | -The y coordinate of where to create the particles. | -
parttype | -Particle Type ID | -The index (type) of the particles to be created. | -
colour | -Colour | -The colour blending for the particles. | -
number | -Real | -The number of particles to create. | -
-
N/A
--
if (speed > 1)
-
- {
-
- var _c = choose(c_aqua, c_lime, c_fuchsia, c_orange);
-
- part_particles_create_colour(sname, x, y, p_Smoke, _c, 1);
-
- }
The above code will generate a single particle every step that the instance with the code has a speed greater than one. These particles will be of a random colour.
--
-
-
This function permits you to quickly and easily create particles at any position in a particle system.
+It is ideal for those effects that do not require any of the functionality offered by Particle Emitters (for example, to create smoke from a missile, or a simple explosion effect).
+You can also colour the particles "on the fly" as they are created with this function, and this colour will override the predefined colour of the particle, but it does not blend this colour over the particle's lifetime.
+You must have created the particle system and the particle type previously for this function to be used.
++
part_particles_create_colour(ind, x, y, parttype, colour, number);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system. | +
x | +Real | +The x coordinate of where to create the particles. | +
y | +Real | +The y coordinate of where to create the particles. | +
parttype | +Particle Type ID | +The index (type) of the particles to be created. | +
colour | +Colour | +The colour blending for the particles. | +
number | +Real | +The number of particles to create. | +
+
N/A
++
if (speed > 1)
+ {
+ var _c = choose(c_aqua, c_lime, c_fuchsia, c_orange);
+ part_particles_create_colour(sname, x, y, p_Smoke, _c, 1);
+ }
The above code will generate a single particle every step that the instance with the code has a speed greater than one. These particles will be of a random colour.
++
+
This function changes the angle that the given particle system is rendered with.
--
part_system_angle(ind, angle);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to change. | -
angle | -Real | -The new angle of the particle system. | -
-
N/A
--
var _mouse_dir = point_direction(x, y, mouse_x, mouse_y);
-
- part_system_angle(pt_sys, _mouse_dir);
This gets the direction from the position of the instance towards the mouse cursor, and applies that as the angle of a particle system.
--
-
This function changes the angle that the given particle system is rendered with.
++
part_system_angle(ind, angle);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to change. | +
angle | +Real | +The new angle of the particle system. | +
+
N/A
++
var _mouse_dir = point_direction(x, y, mouse_x, mouse_y);
+ part_system_angle(pt_sys, _mouse_dir);
This gets the direction from the position of the instance towards the mouse cursor, and applies that as the angle of a particle system.
++
+
This function can be used to switch off the drawing of a particle system so that any updates done to the system (automatic or otherwise) will not be seen. This is a purely visual option and when set to false you will not be able to see the particles as they are not drawn, but they still exists and are changing position, colour etc... as they would normally. When automatic drawing is off, you can explicitly order GameMaker to draw the current state of the particle system using the function part_system_drawit(), and if you set this function to true again you can switch automatic drawing back on.
-One thing to note is that if you are using the simple effects created by the functions effect_create_above() or effect_create_below() then you can use the values of 0 (for below effects) or 1 (for above effects) as the particle system index and so toggle the automatic draw for these too (this will also work to toggle drawing for the GML Visual particle effects).
--
part_system_automatic_draw(ind, automatic);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to change. | -
automatic | -Boolean | -Whether automatic drawing is on (true) or not (false). | -
-
N/A
--
part_system_automatic_draw(global.Sname, false);
-The above code switches off automatic drawing for the particle system indexed in the global variable "Sname".
--
-
-
This function can be used to switch off the drawing of a particle system so that any updates done to the system (automatic or otherwise) will not be seen.
+This is a purely visual option and when set to false you will not be able to see the particles as they are not drawn, but they still exist and are changing position, colour, etc. as they would normally. When automatic drawing is off, you can explicitly order GameMaker to draw the current state of the particle system using the function part_system_drawit, and if you set this function to true again you can switch automatic drawing back on.
++
part_system_automatic_draw(ind, automatic);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to change. | +
automatic | +Boolean | +Whether automatic drawing is on (true) or not (false). | +
+
N/A
++
part_system_automatic_draw(global.Sname, false);
+The above code switches off automatic drawing for the particle system indexed in the global variable Sname.
++
+
This function controls whether GameMaker should update the particle system automatically or not, and normally you would not need to use this function as the default value of true (automatic update is on) is what you wish to happen. However, for special effects or for pausing the game, you can set this to false and it will prevent any updates being carried out on the given particle system unless explicitly commanded by the use of the function part_system_update() or you use this function again to turn automatic updates on. No updating means that particles created in this system will no longer change position, colour or any other parameter and that emitters will cease to work too, "freezing" the system at the exact point in which the automatic update was set to false.
-One thing to note is that if you are using the simple effects created by the functions effect_create_above() or effect_create_below() then you can use the values of 0 (for below effects) or 1 (for above effects) as the particle system index and so toggle the automatic update for these too (this will also work to toggle updating for the GML Visual particle effects).
--
part_system_automatic_update(ind, automatic);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to change. | -
automatic | -Boolean | -Whether automatic updating is on (true) or not (false). | -
-
N/A
--
if (global.Pause)
-
- {
-
- part_system_automatic_update(global.Sname, false);
-
- }
The above code will switch off the particle updates if the global variable "Paused" is true.
--
-
-
This function controls whether GameMaker should update the particle system automatically or not.
+Normally you would not need to use this function as the default value of true (automatic update is on) is what you wish to happen. However, for special effects or for pausing the game, you can set this to false and it will prevent any updates being carried out on the given particle system unless explicitly commanded by the use of the function part_system_update or you use this function again to turn automatic updates on. No updating means that particles created in this system will no longer change position, colour or any other parameter and that emitters will cease to work too, "freezing" the system at the exact point in which the automatic update was set to false.
++
part_system_automatic_update(ind, automatic);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to change. | +
automatic | +Boolean | +Whether automatic updating is on (true) or not (false). | +
+
N/A
++
if (global.pause)
+ {
+ part_system_automatic_update(global.Sname, false);
+ }
The above code will switch off the particle updates if the global variable pause is true.
++
+
With this function you can clear the given particle system to its default state, removing all emitters and resetting the depth and position (if they had been changed). Be careful using this function as if you have any instance setting or bursting or any other action using an emitter associated with this system, you will get an error unless you are using the part_emitter_exists() function to check. There is also no need to call the part_emitter_destroy() function as this is taken care of automatically too.
-NOTE: this function will clear the visible particles in the room, but it does not clear the particle properties, nor does it remove them from memory. For that you should use the functions part_type_clear() and part_type_destroy().
--
part_system_clear(ind);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to clear. | -
-
N/A
--
part_system_clear(global.Sname);
-The above code will clear the particle system indexed in the global variable "Sname" to its default state.
--
-
-
-
This function clears the given particle system to its default state, removing all emitters and resetting its depth and position (if they had been changed).
+You should be careful using this function as if you have any instance setting or bursting or any other action using an emitter associated with this system, you will get an error unless you are using the part_emitter_exists function to check. There is also no need to call the part_emitter_exists function as this is taken care of automatically too.
+This function will clear the visible particles in the particle system, but it does not clear the particle properties, nor does it remove them from memory. For that you should use the functions part_type_clear and part_type_destroy.
++
part_system_clear(ind);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to clear. | +
+
N/A
++
part_system_clear(global.Sname);
+The above code will clear the particle system indexed in the global variable Sname to its default state.
++
+
This function changes the blend colour and alpha that the given particle system is rendered with. This is similar to image_blend and image_alpha in instances.
--
part_system_color(ind, color, alpha);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to change. | -
color | -Colour | -The new colour of the particle system. | -
alpha | -Real | -The new alpha of the particle system. | -
-
N/A
--
part_system_colour(pt_sys, c_red, 0.5);
-This changes the colour of a particle system to red, with an alpha of 0.5.
--
-
This function changes the blend colour and alpha that the given particle system is rendered with. This is similar to image_blend and image_alpha in instances.
++
part_system_colour(ind, color, alpha);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to change. | +
color | +Colour | +The new colour of the particle system. | +
alpha | +Real | +The new alpha of the particle system. | +
+
N/A
++
part_system_colour(pt_sys, c_red, 0.5);
+This changes the colour of a particle system to red, with an alpha of 0.5.
++
+
With this function you can set the draw depth for the particle system, much the same as you can set the render depth of different layers within the room, where a low draw depth means that it will appear on top of all things drawn with a higher depth, and a high draw depth placing it below everything with a lower draw depth.
--
part_system_depth(ind, depth);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System Instance | -The particle system to change. | -
depth | -Real | -The depth at which to set the particle system. | -
-
N/A
--
global.Sname = part_system_create();
-
- part_system_depth(global.Sname, -1000);
The above code will create a particle system and store its index in the global variable "Sname". this system is then given a low depth of -1000, meaning that it will appear above everything with a higher draw depth.
--
-
With this function you can set the draw depth for the particle system, much the same as you can set the render depth of different layers within the room, where a low draw depth means that it will appear on top of all things drawn with a higher depth, and a high draw depth placing it below everything with a lower draw depth.
++
part_system_depth(ind, depth);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to change. | +
depth | +Real | +The depth at which to set the particle system. | +
+
N/A
++
global.Sname = part_system_create();
+ part_system_depth(global.Sname, -1000);
The above code will create a particle system and store its index in the global variable Sname. this system is then given a low depth of -1000, meaning that it will appear above everything with a higher draw depth.
++
+
This function draws the given particle system.
-By default, every particle system that you create is drawn automatically by GameMaker. You can also draw it manually using this function.
-If part_system_automatic_draw is switched off then this function will show the particles when used in the draw event of an instance. It can also be used when the drawing target is set to a surface (using surface_set_target) to draw the particles in the system to that surface.
-Call this function in any of the Draw Events to draw the particle system whenever you want. Call it in a Draw End event to draw the particles in front of other graphics or in one of the Draw GUI events to draw them on the GUI layer.
--
part_system_drawit(ind);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to draw. | -
-
N/A
--
if (surface_exists(surf))
-
- {
-
- surface_set_target(surf);
-
- part_system_drawit(global.psys);
-
- surface_reset_target();
-
- }
The above code checks to see if the surface indexed in the variable surf exists. If it does it then sets the drawing target to the surface, draws the particle system with the ID stored in the global variable, and then resets the drawing target so all normal drawing appears on the screen once more.
--
-
This function draws the given particle system.
+By default, every particle system that you create is drawn automatically by GameMaker. You can also draw it manually using this function.
+If part_system_automatic_draw is switched off then this function will show the particles when used in the draw event of an instance. It can also be used when the drawing target is set to a surface (using surface_set_target) to draw the particles in the system to that surface.
+Call this function in any of the Draw Events to draw the particle system whenever you want. Call it in a Draw End event to draw the particles in front of other graphics or in one of the Draw GUI events to draw them on the GUI layer.
++
part_system_drawit(ind);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to draw. | +
+
N/A
++
if (surface_exists(surf))
+ {
+ surface_set_target(surf);
+ part_system_drawit(global.psys);
+ surface_reset_target();
+ }
The above code checks to see if the surface indexed in the variable surf exists. If it does it then sets the drawing target to the surface, draws the particle system with the ID stored in the global variable, and then resets the drawing target so all normal drawing appears on the screen once more.
++
+
With this function you can check to see if the given particle system indexed exists in the game or not. Note that if the variable being checked is an uninitialised variable (that a particle system would otherwise have its index assigned to) this will throw an error.
--
part_system_exists(ind);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to check for. | -
-
Boolean
--
if (!part_system_exists(global.Sname))
-
- {
-
- global.Sname = part_system_create();
-
- }
The above code checks to see if the particle system referenced in the global variable exists and if it does not it is created.
--
-
-
This function checks to see if the given particle system exists in the game or not.
+Note that if the variable being checked is an uninitialised variable (that a particle system would otherwise have its index assigned to) this will throw an error.
++
part_system_exists(ind);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to check for. | +
+
+
if (!part_system_exists(global.Sname))
+ {
+ global.Sname = part_system_create();
+ }
The above code checks to see if the particle system referenced in the global variable exists and if it does not it is created.
++
+
This function can be used to retrieve the layer handle for the given particle system. You supply the particle system handle (as returned by the function part_system_create_layer()) and the function will return the handle of the layer.
+This function retrieves the layer handle for the given particle system.
+You supply the particle system handle (as returned by the function part_system_create_layer) and the function will return the handle of the layer.
part_system_get_layer(ind);
+part_system_get_layer(ind);
Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to change. | -
x | -Real | -The new x coordinate of the particle system. | -
y | -Real | -The new y coordinate of the particle system. | -
-
N/A
--
if (mouse_check_button_pressed(mb_left))
-
- {
-
- part_system_position(global.Sname, mouse_x, mouse_y);
-
- }
The above code will check for the press of the mouse button and if it detects one, the particle system indexed in the global variable "Sname" is shifted to the mouse x/y position
--
-
-
This function sets the base position for the particle system relative to the (0, 0) position of the room.
+As a result, all further particle functions relating to this system will now be drawn relative to the new position. By default this position is always (0, 0), but in some very special circumstances you may wish to change this to something else.
+This function will change everything within the particle system, so if you have an emitter at position (100, 100) and then set the particle system position to (0, 100), the emitter will now draw at (100, 200). The same goes if you shift the system and then create the emitter, as even though you create it at (100, 100) it will be drawn at (100, 200).
++
part_system_position(ind, x, y);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to change. | +
x | +Real | +The new x coordinate of the particle system. | +
y | +Real | +The new y coordinate of the particle system. | +
+
N/A
++
if (mouse_check_button_pressed(mb_left))
+ {
+ part_system_position(global.Sname, mouse_x, mouse_y);
+ }
The above code will check for the press of the mouse button and if it detects one, the particle system indexed in the global variable Sname is shifted to the mouse x/y position.
++
+
This function will advance the given particle system one step in game time and can be used to simulate the particle system behaviour when automatic updating is off, or it can be used to advance a particle system to a specific point all in one step. For example, if you have a particle system for snow, and you want it to appear that the snow is falling right from the moment the player enters the room then you may wish to advance your snow particles for a few seconds in the create event of an instance so that the first time they are drawn, there are particles all over the screen (the code example below shows this). You can also use this function when automatic updating of the system is switched off by the function part_system_automatic_update to move the system along.
--
part_system_update(ind);
-Argument | -Type | -Description | -
---|---|---|
ind | -Particle System ID | -The particle system to update. | -
-
N/A
--
repeat (game_get_speed(gamespeed_fps) * 3)
-
- {
-
- part_system_update(global.RainSys);
-
- }
The above code will advance the particle system indexed in the global variable RainSys by 3 seconds.
--
-
This function will advance the given particle system one step in game time and can be used to simulate the particle system behaviour when automatic updating is off, or it can be used to advance a particle system to a specific point all in one step. For example, if you have a particle system for snow, and you want it to appear that the snow is falling right from the moment the player enters the room then you may wish to advance your snow particles for a few seconds in the Create event of an instance so that the first time they are drawn, there are particles all over the screen (the code example below shows this). You can also use this function when automatic updating of the system is switched off by the function part_system_automatic_update to move the system along.
++
part_system_update(ind);
+Argument | +Type | +Description | +
---|---|---|
ind | +Particle System Instance | +The particle system to update. | +
+
N/A
++
repeat (game_get_speed(gamespeed_fps) * 3)
+ {
+ part_system_update(global.RainSys);
+ }
The above code will advance the particle system indexed in the global variable RainSys by 3 seconds.
++
+
This function is used to set a particle type to have a single alpha value (transparency) for the total duration of the lifetime of each individual particle, and this can be from 0 (transparent) to 1 (opaque).
part_type_alpha1(ind, alpha1);
+part_type_alpha1(ind, alpha1);
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
alpha1 | -Real | +Real | The alpha of the particle. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
alpha1 | -Real | +Real | The start alpha of the particle. | |
alpha2 | -Real | +Real | The end alpha of the particle. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
alpha1 | -Real | +Real | The starting alpha of the particle. | |
alpha2 | -Real | +Real | The halfway point alpha of the particle. | |
alpha3 | -Real | +Real | The ending alpha of the particle. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
additive | -Boolean | -Whether the particles should be blended additively (true) or normally (false). | +Boolean | +Whether the particles should be blended additively (true) or normally (false). |
N/A
part_type_blend(part_Fire, true);
-The above code will set all particles created of the particle type indexed in the variable "part_Fire" to have an additive blend mode.
-+
part_type_blend(part_fire, true);
+The above code will set all particles created of the particle type indexed in the variable part_fire to have an additive blend mode.
With this function you can "reset" a particle, returning all the values for each of the functions relating to the particle (life, colour, alpha, orientation etc...) to their default values. Note that this function does not remove any particles currently visible in the room from the screen, for that you should be using part_particles_clear().
+This function "resets" a particle type, returning all the values for each of the type's properties (life, colour, alpha, orientation, etc.) to their defaults.
+This function does not remove any particles currently visible in the room, for that you should be using part_particles_clear.
part_type_clear(ind);
+part_type_clear(ind);
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to clear. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
death_number | -Real | +Real | The quantity of the new particle to create at the particle death. If a negative value, it will instead create a fraction chance one is created (eg -3 would mean that one is created every 3 or so steps). | |
death_type | -Particle Type ID | +Particle Type ID | The index of the particle type to create at death. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to destroy. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
dir_min | -Real | +Real | The minimum direction the particle can start at. | |
dir_max | -Real | +Real | The maximum direction the particle can start at. | |
dir_incr | -Real | +Real | How much the particle direction should increase or decrease per step. | |
dir_wiggle | -Real | +Real | How much should randomly be added or subtracted from the particle's direction per step. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to check for. |
Boolean
+
if (!part_type_exists(global.p1))
+
if (!part_type_exists(global.p1))
{
global.p1 = part_type_create();
}
The above code checks to see if the global variable "p1" stores the index of a particle type and if it does not it creates one.
-+
The above code checks to see if the global variable p1 stores the index of a particle type and if it does not it creates one.
This function will set the gravity that is to affect each particle of the given type that is created. The gravity strength value is added to the particle speed every step and is usually a small value like 0.5, while the direction is the direction of the gravity "pull" and follows the standard GameMaker directions of 0° being right, 90° being up, 180° being left and 270° being down.
+This function sets the gravity that is to affect each particle of the given type that is created.
+The gravity strength value is added to the particle speed every step and is usually a small value like 0.5, while the direction is the direction of the gravity "pull" and follows the standard GameMaker directions of 0° being right, 90° being up, 180° being left and 270° being down.
part_type_gravity(ind, grav_amount, grav_direction);
+part_type_gravity(ind, grav_amount, grav_direction);
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
grav_amount | -Real | +Real | Strength of the gravity. | |
grav_direction | -Real | +Real | The direction of the gravity. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. | |
ang_min | -Real | +Real | The minimum starting angle of the particles. | |
ang_max | -Real | +Real | The maximum starting angle of the particles. | |
ang_incr | -Real | +Real | The increase (or decrease if set negative) of the angle in degrees per step. | |
ang_wiggle | -Real | +Real | The amount the angle wiggles clockwise/counterclockwise per step. | |
ang_relative | -Real | -Whether to set its angle relative to the direction of the particle's motion (true) or not (false). | +Real | +Whether to set its angle relative to the direction of the particle's motion (true) or not (false). |
The above code will set various particle values including the orientation which will be random value between 0º and 359º. It will also have a random amount added to it of anywhere between 0 and 20 each step too, and the orientation is relative to the direction of motion.
-
This function sets the horizontal and vertical scale of the particle before any other size changes are made. This function works on the ratio of the sprite size, so a value of 1 (the default value) is a 1:1 ratio, meaning that 0.5 would be half and 2 double.
+This function sets the horizontal and vertical scale of the particle before any other size changes are made. It works on the ratio of the sprite size, so a value of 1 (the default value) is a 1:1 ratio, meaning that 0.5 would be half and 2 double.
part_type_scale(ind, xscale, yscale);
+part_type_scale(ind, xscale, yscale);
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. |
xscale | -Real | +Real | The horizontal scaling of the base particle. |
yscale | -Real | +Real | The vertical scaling of the base particle. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. |
speed_min | -Real | +Real | The minimum speed the particle can start at. |
speed_max | -Real | +Real | The maximum speed the particle can start at. |
speed_incr | -Real | +Real | How much the particle speed should increase or decrease per step. |
speed_wiggle | -Real | +Real | How much should randomly be added or subtracted from the particle's speed per step. |
ind | -Particle Type ID | +Particle Type ID | The index of the particle type to change. |
step_number | -Real | +Real | The quantity of the new particle to create per step. |
step_type | -Particle Type ID | +Particle Type ID | The index of the particle type to create per step. |