ArcadeSortGroupBottomTop
ceramic.ArcadeSortGroupBottomTop (Class)
Specialized merge sort implementation for sorting physics bodies.
This class provides a stable, high-performance sort specifically optimized for
Arcade physics collision detection. The implementation is based on Haxe's standard
library merge sort but has been heavily optimized with inlined functions and
specialized comparison logic for physics bodies.
Four different sort orders are provided:
- ArcadeSortGroupLeftRight: Sort by X position ascending (left to right)
- ArcadeSortGroupRightLeft: Sort by X position descending (right to left)
- ArcadeSortGroupTopBottom: Sort by Y position ascending (top to bottom)
- ArcadeSortGroupBottomTop: Sort by Y position descending (bottom to top)
See: ArcadeWorld for usage in collision detection
Static Members
Sorts an array of visuals by their physics body position.
This operation modifies the array in place and preserves the relative order
of visuals with the same position (stable sort). Visuals without physics
bodies are treated as having position 0.
Name |
Type |
Description |
a |
Array<Visual> |
The array of visuals to sort |
Private Members
Compares two visuals based on their physics body Y position (reversed).
Name |
Type |
Description |
a |
Visual |
First visual to compare |
b |
Visual |
Second visual to compare |
Returns |
Description |
Int |
1 if b.body.y > a.body.y, -1 otherwise, 0 if either has no body |