SpriteCollectionstaticSize Field |
Namespace: (Default Namespace)
Sprites defined in the map editor are considered "static" and will always exist, although they may be inactive (invisible and excluded from processing rules). But sprites can also be added at runtime. These are referred to as "dynamic" sprites. When a dynamic sprite is added, it is appended to the end of the main sprite collection for the layer (m_Sprites) as well as all categories designated to include the specified sprite type (which are also SpriteCollection objects). So each sprite collection has a segment (at the beginning) of static sprites and a segment at the end (beginning at index determined by staticSize) containing zero or more dynamic sprites.
This value, then, represents the number of static sprites in the collection (whether it be a layer's main collection or a category within the layer). It is used to ensure that no static sprite can ever be completely removed from the collection because these should always be available for activation. And sprites in the collection beyond this range are the only sprites that need to be considered for removal after a layer's rules are done executing. Only the range of dynamic sprites will be checked for inactive sprites. Inactive dynamic sprites are removed from all the categories in which they were a member.