• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED part_type_orientation acting on previously created particles

NeoShade

Member
Hi All,

Just a quick one today, because I think I may have come across a bug.
I'm running the following code in an instance destroy event:

GML:
for (var i = 1; i < num+1; ++i) {
        
    // Find corners
    var x1 = x+lengthdir_x(point[i], image_angle+i*(360/num));
    var y1 = y+lengthdir_y(point[i], image_angle+i*(360/num));
    var x2 = x+lengthdir_x(point[i-1], image_angle+(i-1)*(360/num));
    var y2 = y+lengthdir_y(point[i-1], image_angle+(i-1)*(360/num));
        
    // Find midpoints
    var len = point_distance(x1, y1, x2, y2);
    var dir = point_direction(x1, y1, x2, y2);
    var x3 = x1 + lengthdir_x(len/2, dir);
    var y3 = y1 + lengthdir_y(len/2, dir);
    
    // Create particles
    part_type_scale(PT_DEBRIS, len/2, 1);
    part_type_orientation(PT_DEBRIS, dir, dir, random_range(-5, 5), 0, 0);
    part_particles_create(PS, x3, y3, PT_DEBRIS, 1);
}
What I'm trying to achieve is that each "side" of the instance being destroyed will break apart and rotate at a random speed, as per random_range(-5,5).
What's actually happening is that all of the sides rotate at the same speed in the same direction.

All of the other part_type_ functions appear to only affect particles created after the function call, but part_type_orientation seems to affect even those particles created before the call.
Am I missing something here?
 
I've been meaning to do some testing to figure out exactly what's going on with this, but I I seem to remember running into this issue as well. Not sure if it's intended functionality or not. It's pretty annoying in any case. Kind of limits some of the dynamic things that are achievable with particles.
 

NeoShade

Member
I've actually just asked the question on the discord server and found that this is expected behaviour:

Yep, this is normal; particle settings that apply change over time (like the wiggle) apply to all particles of that type, while particle settings that set a value (like speed or direction) are applied to a particle upon creation
Looks like I'll be creating some particle types dynamically instead.
 
Top