instance_select_sort(obj_or_instance_or_array_of_them, variable_name, [ascending]);
Argument name Type Description
obj_or_instance_or_array_of_them array|instance|object The instances, objects, or combination of them
variable_name string variable name as a string (which value will be used for testing)
ascending boolean If true, (the default) the values will be sorted in ascendent order

Returns: (array) The array with the instances


Returns an array with all instances specified (check below) sorted by the propietry of the specified variable_name. You can sort ascending or descending.

For more info about obj_or_instance_or_array_of_them argument check instance_select();

Example: In the room you have 5 instances of obj_box placed at random locations. If you call: var arr = instance_select_sort( obj_box, set_y ); It will return an array with the 5 instances of obj_box sorted from the top box to the bottom box on the room. (using the set_y setter script) This script is useful to use it in conjunction with tween_stagger_to/from/fromto and tweenline_stagger_to/from/fromto functions like: var arr = instance_select_sort( obj_box, set_y ); tween_stagger_from( arr, 1, array("alpha",0), .5);