SpriteBaseTileActivateSprite Method |
Namespace: (Default Namespace)
public virtual int TileActivateSprite( int TouchingIndex, SpriteCollection Category, bool ClearParameters )
This function allows you to treat a number of sprites within a category as kind of a dynamic collection of sprites which can be activated one after the other. Each time this is called, it will find and activate the next inactive sprite within the category. This limits the number of sprites that can be activated by this function to the number of actual sprite instances in the specified category on the layer where the function is executed. For a truly dynamic collection of sprites, see TileAddSprite(Int32, Type).
Clearing the parameters of a newly activated sprite can be very useful in initializing the sprite as soon as it is activated because the activated sprite can check to see when a particular parameter is zero. If it sees that it's zero, it can immediately set it to some other value and perform whatever initialization it needs to (such as offsetting its position from the tile by some pre-set distance).