M
meme
Guest
Hello there! I know this type of question has been asked frequently, but I still don't get how to destroy particle system properly. So this is how I construct my particle system:
So the required particles are stored inside global.partPlayer struct. This is how I initialize each of the particle inside the struct:
Finally, in the clean up event I just do:
part_system_destroy(global.partSystem);
I don't know whether destroying the system will destroy all particle types inside it. Do I actually need to iterate through the struct and delete the particle type 1 by 1?
Thank you for reading, if u have any suggestion feel free to share!
GML:
// The main particle system
global.partSystem = part_system_create();
global.partPlayer = {
trail : 0,
bullet : 0,
bulletEnd : 0,
}
So the required particles are stored inside global.partPlayer struct. This is how I initialize each of the particle inside the struct:
Code:
// Trail
var _trail = part_type_create();
part_type_sprite(_trail, smCircle4, 0, 0, 0);
part_type_life(_trail, 50, 60);
part_type_size(_trail, 0.5, 0.8, 0, 0);
part_type_speed(_trail, 0.02, 0.03, 0, 0);
part_type_direction(_trail, 85, 95, 0, 0);
part_type_color2(_trail, $4f4f4f, $b6b6b6);
part_type_alpha2(_trail, 1, 0);
part_type_orientation(_trail, -10, 10, 5, 0, 0);
global.partPlayer.trail = _trail;
// Bullet
var _bullet = part_type_create();
part_type_sprite(_bullet, smBit1x1, 0, 0, 1);
part_type_life(_bullet, 50, 60);
part_type_size(_bullet, 0.8, 1, -0.025, 0);
part_type_speed(_bullet, 0.05, 0.08, 0, 0);
part_type_direction(_bullet, 75, 115, 0, 0);
part_type_color1(_bullet, global.auraColor);
part_type_orientation(_bullet, -45, 45, 0, 0, 0);
global.partPlayer.bullet = _bullet;
// And so on...
Finally, in the clean up event I just do:
part_system_destroy(global.partSystem);
I don't know whether destroying the system will destroy all particle types inside it. Do I actually need to iterate through the struct and delete the particle type 1 by 1?
Thank you for reading, if u have any suggestion feel free to share!