# SetSpriteDepth

## Description

Sets the draw order for the sprite between 0-10000, 0 being the front of the screen, 10000 being the back. Anything above 10000 will result in the sprite being clipped from view. By default sprites are at depth 10. If two sprites occupy the same depth then the order they are drawn is undefined unless SetSortCreated is used to true, in which case sprites at the same depth will be drawn in the order they were created. For maximum performance it is recommended that every sprite has its own depth value unless the order they are drawn is not important, for example physics sprites that won't normally overlap. Note that if you are not using any 3D objects and you are using sprite depths greater then 5000 you should use SetGlobal3DDepth to 10000 to improve performance (essentially bringing all sprites to the front of the 3D renderer).

## Definition

SetSpriteDepth ( iSpriteIndex, iDepth )

void agk::SetSpriteDepth ( UINT iSpriteIndex, int iDepth )

## Parameters

- iSpriteIndex - The ID of the sprite to modify.
- iDepth - The depth this sprite should be drawn at.