SOLVED Delete all particles after a certain Y value?

CraterHater

Member
Hey,

I've got this particle effect here:
GML:
global.part_wall_dust_shard = part_type_create();
part_type_sprite(global.part_wall_dust_shard,spr_particle_shards,0,0,1);
part_type_size(global.part_wall_dust_shard,.25,0.90,-.001,0);
part_type_orientation(global.part_wall_dust_shard,0,360,0.5,0.5,0);
part_type_color2(global.part_wall_dust_shard,make_color_rgb(130, 100, 68),make_color_rgb(73, 57, 48));
part_type_alpha3(global.part_wall_dust_shard,0.7,1,0.5);
part_type_blend(global.part_wall_dust_shard,false);
part_type_direction(global.part_wall_dust_shard,70,110,.01,.01);
part_type_speed(global.part_wall_dust_shard,7.5,10,0,0);
part_type_life(global.part_wall_dust_shard,45,85);
part_type_gravity(global.part_wall_dust_shard, 0.35, 270);
How can I make it so that when a particle crosses a certain Y value it fades out?

Thanks!
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
You can't, basically... Particles are "fire and forget" graphics effects that, once they have been created or emitted, can't be edited or changed individually. What is the effect you are trying to achieve? There may be a better way to do it, or a workaround.
 

Bart

WiseBart
There used to be the part_destroyer functions that could be used for this but they've been removed a long time ago.
The only way now to get the effect you're looking for is to play with the values of life, speed, alpha, orientation, ... until you get the effect that you want.
And put limitations on those values, such as constant life and speed, no gravity, etc. to make everything fully predictable. Then again, that also severely limits the number of different particle effects you can create.
A certain y is likely impossible to get right but it should be possible to make the particles fade out in a given y range.

Another thing that may work are physics particles.
In this case you can use physics_particle_draw to display the particles and physics_particle_delete_region_box to delete those particles that cross a certain y value (which can then be set as an exact threshold).
Not too sure if it's possible to fade, though...

Both of these are more or less workarounds but they're probably the closest you can get to the effect that you're looking for.
 

CraterHater

Member
Thank you all for your answers. I tried it using objects and it works very well. It is probably less efficient but if that is the only way then so be it.
 
Top