a_d_d_y
Member
MOD EDIT: New topic created from this one: https://forum.yoyogames.com/index.p...acting-on-previously-created-particles.80813/
Please do not use someone else's topic to discuss your own issues, make a new topic, and link to any other topics for reference.
Hi NeoShade
I've exact the same issue in my project.
I am trying to generate a Lightning Bolt with particles.
Therefore I have a ds_list of segment points which I want to connect through a stretched-1-Pixel-particle.
I tried to use particle scale for that. Unfortunately all Particles have the same length (the last length in the for-loop).
Below I show you a code example with predefined points.
Exept of the 3rd List entry, all segments are 100pt. long.
The 3rd segment is factor 1.414 longer.
If I run that code as it is, then the particle of the 3rd segment will be too short (only 100 instead of 141.4)
If I delete the last ds_list_add entry, all other particles exept of the 3rd will be too long (141.4 instead of 100)
Have you an idea how to solve that problem?
Many thanks in advance
a_d_d_y
Please do not use someone else's topic to discuss your own issues, make a new topic, and link to any other topics for reference.
Hi NeoShade
I've exact the same issue in my project.
I am trying to generate a Lightning Bolt with particles.
Therefore I have a ds_list of segment points which I want to connect through a stretched-1-Pixel-particle.
I tried to use particle scale for that. Unfortunately all Particles have the same length (the last length in the for-loop).
Below I show you a code example with predefined points.
Exept of the 3rd List entry, all segments are 100pt. long.
The 3rd segment is factor 1.414 longer.
If I run that code as it is, then the particle of the 3rd segment will be too short (only 100 instead of 141.4)
If I delete the last ds_list_add entry, all other particles exept of the 3rd will be too long (141.4 instead of 100)
Have you an idea how to solve that problem?
Many thanks in advance
a_d_d_y
GML:
// CREATE EVENT
lightningBolt = ds_list_create();
ds_list_add(lightningBolt, [100, 100, 200, 100, 0, 1]);
ds_list_add(lightningBolt, [200, 100, 200, 200, -90, 1]);
ds_list_add(lightningBolt, [200, 200, 300, 300, -45, 1]);
ds_list_add(lightningBolt, [300, 300, 400, 300, 0, 1]);
psLightningBolt = part_system_create();
part_system_layer(psLightningBolt,layer);
part_system_automatic_draw(psLightningBolt,false);
ptLightningBolt = part_type_create();
part_type_life(ptLightningBolt,200,200);
part_type_gravity(ptLightningBolt,0,0);
part_type_speed(ptLightningBolt,0,0,0,0);
part_type_direction(ptLightningBolt,0,359,0,0);
part_type_size(ptLightningBolt,1,1,0,0);
part_type_blend(ptLightningBolt,1);
part_type_alpha3(ptLightningBolt,1,1,1);
part_type_color3(ptLightningBolt,make_color_rgb(128,128,255),make_color_rgb(128,128,255),make_color_rgb(128,255,255));
part_type_sprite(ptLightningBolt,sprLightningBoltParticle,0,0,0);
// DRAW EVENT
var numberOfSegments = ds_list_size(lightningBolt);
for (i = 0; i < numberOfSegments; i++)
{
var segment = ds_list_find_value(lightningBolt,i);
var xx1 = segment[0];
var yy1 = segment[1];
var xx2 = segment[2];
var yy2 = segment[3];
var angle = segment[4];
var alpha = segment[5];
var length = point_distance(xx1,yy1,xx2,yy2);
part_type_scale(ptLightningBolt, length, 1);
part_type_orientation(ptLightningBolt,angle,angle,0,0,0);
part_particles_create(psLightningBolt,xx1,yy1,ptLightningBolt,1);
}
part_system_drawit(psLightningBolt);
// CLEAN-UP EVENT
part_type_destroy(ptLightningBolt);
part_system_destroy(psLightningBolt);
Last edited: