Returns the first sprite found under the point X,Y in world coordinates and belonging to the given categories. Nil if none.
class function HitCategory(const Categories: Cardinal; const X: Single; const Y: Single): TAgkSprite; overload;
Parameters |
Description |
const Categories: Cardinal |
The categories to check. |
const X: Single |
The X position in world coordinates to check. |
const Y: Single |
The Y position in world coordinates to check. |
The sprite at this position and in these categories, or nil.
Sprites are ordered by depth so a sprite appearing above another in the draw order will be returned instead of the sprite behind it.
This function filters the results so only sprites of certain categories are checked. The categories parameter is a bitwise field that uses the lower 16 bits to represent each of the possible 16 categories used when setting up a sprite. The default value of all 1s means all categories will be included, whereas a value of all 0s means no categories will be included. You can set individual bits to set which ones should be checked. You can set which categories a sprite belongs to with CategoryBits.
Takes into account the rotation and scale values of the sprite. It does not take into account the transparency of the sprite, only its collision shape. Uses the shape assigned to it from Shape. If no shape is set it uses the sprite width and height as a box shape. If you are testing a mouse or touch coordinate, remember to convert it to world coordinates using TAgkScene.ScreenToWorld.
Copyright (c) 2012. All rights reserved.
|