To create particles with GML, you need (1) a Particle System, and (2) a Particle Type.
A Particle System can be created in a controller object:
/// Create event global.partSystem = part_system_create(); part_system_depth(global.partSystem, -100); // Set depth /// Clean Up event part_system_destroy(global.partSystem);
This particle system will be used for creating particles.
The actual particles that will be created, will come from Particle Types. Here is an example of one particle type:
global.ptBasic = part_system_create(); part_type_shape(global.ptBasic, part_type_disk); part_type_life(global.ptBasic, 30, 40); part_type_alpha2(global.ptBasic, 1, 0);
This particle type will have a disk shape, a life of between 30 and 40 steps (selected at random), and an alpha fading from 1 to 0.
This can then be created anywhere, anytime, using this function:
part_particles_create(global.partSystem, x, y, global.ptBasic, 1);
The particle will be created in the specified particle system.