The SortYSpritesSecondary performs a sort on all ordered Sprites so that sprites with a larger Y are drawn first. The sorting based off of Y is only done on Sprites which have the same Z value. Therefore, Z takes first priority, then Sprites with the same Z will be sorted so Sprites at the bottom of the screen (smaller Y values) will be drawn last (on top).
If you desire to sort the Sprites by their Y to control drawing order, it is usually better to assign FlatRedBall.SpriteManager.OrderedSortType so that the ordered sort type doesn’t conflict with the manual Y-based sorting.
To use SortYSpritesSecondary, simply call the method every frame at the end of Update.
Simply add the following code at the end of your Update call (or your Screen’s Activity method):