Added sorting of entities by y-value for better drawing order.