# SetSpriteImage

## Description

Change the sprite image to a new loaded image. If the new image has a different size or shape from the old image the sprite may look distorted as a result, you can fix this by resetting the sprite dimensions using SetSpriteSize. If the sprite is animated you may also need to call SetSpriteAnimation again.
In the case of circle and polygon sprites you may set whether the sprite uses this new image to change its collision shape. Box shapes are not affected by image changes. Using this command will clear any animation frames you have set with any of the sprite animation commands.

## Definition

SetSpriteImage ( iSpriteIndex, iImageIndex, bUpdateShape )

void agk::SetSpriteImage ( UINT iSpriteIndex, UINT iImageIndex, int bUpdateShape )

SetSpriteImage ( iSpriteIndex, iImageIndex )

void agk::SetSpriteImage ( UINT iSpriteIndex, UINT iImageIndex )

## Parameters

- iSpriteIndex - The ID of the sprite to modify.
- iImageIndex - The ID of the image to use for this sprite.
- bUpdateShape - Sets whether the collision shape of this sprite should be changed to match the new image. ( 1 or 0 )