You could create a custom type which has two fields, one for the Z depth and one for the sprite object. Create a Compare() method so that the type can be sorted in a TList.
Alternatively, you could just add a Compare method to your Sprite type which sorts according to z-depth.
Type ZSortable Field z:Float Field o:Object 'Replace this with your sprite Method Compare(other:Object) If ZSortable(other).z < z Return -1 Return 1 End Method End Type
Alternatively, you could just add a Compare method to your Sprite type which sorts according to z-depth.