# GetSpriteDistance

## Description

Calculates the minimum distance separating the two sprites. 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 can be found using GetSpriteDistancePoint1X, etc. This calculation takes longer than simply checking if the sprites overlap, if you don't need the distance separating the sprites use GetSpriteCollision.
This function is not limited by group or category settings.
If you have not assigned a shape to either sprite using SetSpriteShape they will use the default box shape based on the sprite's width and height.

## Definition

float GetSpriteDistance( iSprite1, iSprite2 )

float agk::GetSpriteDistance( UINT iSprite1, UINT iSprite2 )

## Parameters

- iSprite1 - The sprite to check for distance with sprite 2
- iSprite2 - The sprite to check for distance with sprite 1