C
Crossoni
Guest
I'm trying to use same particle system on multiple objects with different part_type settings, but for some reason the objects use the same settings when using part_particles_create. What I noticed is that draw event and particles work differently on this area:
Particles seems to go through the whole code and then it chooses the last settings given to particle type and system.
Is there a way to use the same particle system and type with multiple objects using different type settings or do I have to use arrays for my particle types? I hope that arrays are not the only solution since it will complicate many things in my code. Here is my code now:
For choosing to use global variables for particles I followed this guide: https://www.yoyogames.com/blog/50/quick-start-to-programming-particles Before this I created the particle system and type separately on every object and destroyed it when the object got destroyed, but it slowed down my game significantly.
Code:
///Draw event
draw_set_color(c_white);
draw_text(x,y,"text"); // Draws white text
draw_set_color(c_red);
draw_text(x,y,"text"); // Draws red text
Code:
///Creating particles
part_type_colour1(global.p_jetpack,c_white);
part_particles_create(global.p_sys_jetpack,x,y,global.p_jetpack,1); // Creates red particle
part_type_colour1(global.p_jetpack,c_red);
part_particles_create(global.p_sys_jetpack,x,y,global.p_jetpack,1); // Creates red particle
Is there a way to use the same particle system and type with multiple objects using different type settings or do I have to use arrays for my particle types? I hope that arrays are not the only solution since it will complicate many things in my code. Here is my code now:
Code:
///Initialize particle systems and types when game launches
global.p_sys_jetpack = part_system_create();
global.p_jetpack = part_type_create();
///Create particles on objects
part_type_blend(global.p_sys_jetpack,true);
part_type_alpha2(global.p_jetpack,1,0.2)
part_type_colour2(global.p_jetpack,colors[jetpackinpos],colors[jetpackoutpos]);
// etc.
part_particles_create(global.p_sys_jetpack,x,y,global.p_jetpack,1);