Calculates the minimum distance separating this sprites and another sprite.
function Distance(const Other: TAgkSprite; out P1: TAgkPoint; out P2: TAgkPoint): Single; overload;
Parameters |
Description |
const Other: TAgkSprite |
the sprite to check for distance with this sprite. |
out P1: TAgkPoint |
Returns the closest point on sprite 1 to sprite 2 |
out P2: TAgkPoint |
Returns the closest point on sprite 2 to sprite 1 |
The minimum distance.
If the sprites overlap this will be less than 0. Otherwise it will be the distance between the closest points on each sprite. These points are returned in P1 and P2. This calculation takes longer than simply checking if the sprites overlap, if you don't need the distance spearating the sprites use Collision or CollidesWith.
This function is not limited by group or category settings.
If you have not assigned a shape to either sprite using Shape they will use the default box shape based on the sprite's width and height.
Copyright (c) 2012. All rights reserved.
|