SpriteBaseTestCollisionRect Method (SpriteCollection) |
Determine whether the solidity rectangle of the sprite overlaps that of any sprite in the specified category.
Namespace: (Default Namespace)Assembly: Default (in Default.exe) Version: 1.0.0.0
Syntax public virtual int TestCollisionRect(
SpriteCollection Targets
)
Parameters
- Targets
- Type: (Default Namespace)SpriteCollection
A sprite category containing sprites that will be checked for collision
with this sprite.
Return Value
Type:
Int32The index of the sprite within the category if a collision is occurring, otherwise -1.
Remarks This can be used to force a simple rectangular collision test even if one or both
sprites involved have a Mask Alpha level greater than 0. This method is recommended
for improved performance when pixel-perfect collision detection is not required.
See Also