# SetSpriteSize

## Description

Sets the sprite to a new width and height. In the default coordinate system a width and height of 100,100 would fill the entire drawable screen (this can be changed using SetVirtualResolution). If either width or height is set, with the other set to -1, the -1 value will be recalculated to maintain the image's aspect ratio so it doesn't look stretched. If both width AND height are set to -1, then the sprite will take on the width of the assigned image and calculate its height so it isn't stretched. This function recalculates the sprite's collision shape, which can be a costly process for circle and polygon shapes. A more efficient way to change the size of a sprite is to scale it using the SetSpriteScale function. This function resets the scale of the sprite.

## Definition

SetSpriteSize( iSpriteIndex, width, height )

void agk::SetSpriteSize( UINT iSpriteIndex, float width, float height )

## Parameters

- iSpriteIndex - The ID of the sprite to retrieve.
- width - the width to use for the sprite, use minus 1 to have this value calculated.
- height - the height to use for the sprite, use minus 1 to have this value calculated.