SpriteBaseTouchTiles Method |
Collects information about tiles the sprite is currently touching.
Namespace: (Default Namespace)Assembly: Default (in Default.exe) Version: 1.0.0.0
Syntax public virtual bool TouchTiles(
TileCategoryName Category
)
Parameters
- Category
- Type: (Default Namespace)TileCategoryName
This should supply a tile category that includes all tiles that the sprite interacts with.
Return Value
Type:
BooleanTrue if the sprite is touching any tiles in the supplied category.
Remarks This must be called before performing most forms of tile interaction.
By supplying a single category containing all tiles with which the sprite may need
to interact, performance is optimized so that each tile touching the sprite only
needs to be inspected once to check if it's relevant. This also helps simplify the
process of processing each tile exactly once by queuing a list of tiles to be
processed and tracking which of those tiles have been processed.
Examples This example will check to see if the current sprite is touching
any tiles in a category named "Touchable" and then (assuming tile numbers 10
and 11 are members of this category) take any tiles whose number is 10 as an
inventory item represented by a counter named "Coins", and take any tiles whose
number is 11 as an inventory item represented by a counter named "Keys".
if (TouchTiles(TileCategoryName.Touchable))
{
TileTake(10,Counter.Coins))
TileTake(11,Counter.Keys))
}
See Also