Click or drag to resize
SpriteBaseTileActivateSprite Method
Activate the next inactive sprite from a category at the coordinates of a tile being touched by the sprite.

Namespace: (Default Namespace)
Assembly: Default (in Default.exe) Version: 1.0.0.0
Syntax
C#
public virtual int TileActivateSprite(
	int TouchingIndex,
	SpriteCollection Category,
	bool ClearParameters
)

Parameters

TouchingIndex
Type: SystemInt32
Index of the tile in the array of tiles to process (TouchedTiles). This can be acquired using TileTouchingIndex(Int32, Boolean, Boolean).
Category
Type: (Default Namespace)SpriteCollection
Category containing sprites that can be activated.
ClearParameters
Type: SystemBoolean
True if the newly activated sprite's parameters should all be set to zero.

Return Value

Type: Int32
The index of the newly activated sprite, if a sprite was activated (this value will be greater than or equal to zero) or -1 if all sprites in the specified category are already activate.
Remarks

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).

See Also