# SetSpriteShape

## Description

Sets the current shape for use in collision detection, hit testing, and physics. A shape can be set without turning physics on, and by default all sprites are set to use the box shape, which is the fastest to setup. If you select no shape (0) then any existing shape will be deleted, and hit testing will use the sprite dimensions instead. Commands that require a shape such as GetspriteCollision will generate a box shape for the sprite if none exists. The shape parameter lets you define what type of bounding box the system should use to detect collisions. Circle will create a perfect circle centered on the sprite's rotation point and big enough to enclose the sprite's visible pixels. Box will create a box around the edges of the sprite, without regard to whether pixels are visible or not. Polygon will create a close fitting convex polygon around the visible pixels of a sprite, with a visible pixel being defined as one with an alpha value greater than 128.
This function will not work on dummy sprites as there is no image to use when calculating a shape, in these cases shapes must be specified manually using SetSpriteShapeBox, SetSpriteShapeCircle, or SetSpriteShapePolygon.
Setting a shape removes all other shapes assigned to the sprite and replaces it with this one.

## Definition

SetSpriteShape( iSpriteIndex, shape )

void agk::SetSpriteShape( UINT iSpriteIndex, int shape )

## Parameters

- iSpriteIndex - The ID of the sprite to modify.
- shape - The shape to use for this sprite, 0=no shape, 1=circle, 2=box, 3=polygon