Funkin/source/util/SortUtil.hx
2022-02-23 16:49:54 -05:00

19 lines
503 B
Haxe

package util;
#if !macro
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.util.FlxSort;
import flixel.FlxObject;
#end
class SortUtil
{
/**
* You can use this function in FlxTypedGroup.sort() to sort FlxObjects by their z-index values.
* The value defaults to 0, but by assigning it you can easily rearrange objects as desired.
*/
public static inline function byZIndex(Order:Int, Obj1:FlxObject, Obj2:FlxObject):Int
{
return FlxSort.byValues(Order, Obj1.zIndex, Obj2.zIndex);
}
}