This function is used to determine the orientation of the particle sprite when it is created and can also be used to make the particle orientation increase or decrease over its lifetime. The minimum and maximum orientation values default at 0 but these values can be changed to randomise the orientation following the standard GameMaker Studio 2 directions of 0 degrees being right, 90 degrees being up, 180 degrees being left and 270 degrees being down. If you set them to the same value the particles will all be created with the same orientation.
You can also set an increment value which will add (if a positive number) or subtract (if a negative number) an amount of degrees to the orientation over its lifetime. This value can be a minimum of (+/-) 0.01.
You can set the "wiggle" factor too, the same as other particle functions. This is a value that will be added or subtracted randomly to the orientation each step of the particles lifetime. Obviouslylarger values are more pronounced than smaller ones, and this value can even be a negative with the maximum range being between -20 and 20.
Finally, you can choose to have the orientation relative or not, which means that while the particle has a direction (and speed) the particle sprite will be orientated around that vector. Bear in mind that if you have the particle speed set to reduce and it reaches 0, the lack of speed sets the direction to the default value of 0° and so a relative orientation will cause the particle sprite to "jump" to a different angle.
part_type_orientation( ind, ang_min, ang_max, ang_incr, ang_wiggle, ang_relative );
|ind||The index of the particle type to change.|
|ang_min||The minimum starting angle of the particles.|
|ang_max||The maximum starting angle of the particles.|
|ang_incr||The increase (or decrease if set negative) of the angle in degrees per step.|
|ang_wiggle||The amount the angle wiggles clockwise/counterclockwise per step.|
|ang_relative||Whether to set its angle relative to the direction of the particle's motion (true) or not (false).|
part_type_size(particle2, 0.10, 0.50, 0.01, 0);
part_type_scale(particle2, 0.30, 0.30);
part_type_speed(particle2, 4, 4, -0.07, 1);
part_type_direction(particle2, 0, 359, 0, 20);
part_type_orientation(particle2, 0, 359, 0, 20, 1);
part_type_life(particle2, 1, 5);
The above code will set various particle values including the orientation which will be random value between 0ï¿½ and 359ï¿½. It will also have a random amount added to it of anywhere between 0 and 20 each step too, and the orientation is relative to the direction of motion.