+ # Draw order, higher values cause this sprite to be drawn latter
+ #
+ # Change this value to avoid artifacts when drawing non-opaque sprites.
+ # In general, sprites with a non-opaque `texture` and sprites closer to
+ # the camera should have a higher value to be drawn last.
+ #
+ # Sprites sharing a `draw_order` are drawn in the same pass.
+ # The sprite to sprite draw order is undefined and may change when adding
+ # and removing sprites, or changing their attributes.
+ #
+ # ### Warning
+ #
+ # Changing this value may have a negative performance impact if there are
+ # many different `draw_order` values across many sprites.
+ # Sprites sharing some attributes are drawn as group to reduce
+ # the communication overhead between the CPU and GPU,
+ # and changing `draw_order` may break up large groups into smaller groups.
+ var draw_order = 0 is writable(draw_order_direct=)
+
+ # Set draw order, see `draw_order`
+ fun draw_order=(value: Int)
+ do
+ if isset _draw_order and value != draw_order then needs_remap
+ draw_order_direct = value
+ end
+