# AddSpriteShapeChain

## Description

Adds a new shape to the sprite, in addition to any it already has. Shapes can be added even if the sprite is not setup for physics.
The chain is defined by a set of points (at least 2) relative to the current sprite's offset. For example, a point of 0,0 would be centered on the sprite's offset point, any other value will be offset from this point. Chains are rigid and can be used to create hollow concave polygons, or 2D terrains. Set the loop parameter to 1 to join to two ends of the chain together creating a hollow polygon. Points are defined one at a time by calling this command multiple times, with index starting at 0. Once the index equals numPoints-1 then the shape will be created using the previously defined points. Once you start defining points you must complete the process by reaching index=numPoints-1 before defining points for any other shape.
This will recalculate the sprite's mass and center of mass values.

## Definition

AddSpriteShapeChain( iSpriteIndex, numPoints, index, loop, x, y )

void agk::AddSpriteShapeChain( UINT iSpriteIndex, UINT numPoints, UINT index, int loop, float x, float y )

## Parameters

- iSpriteIndex - The ID of the sprite to modify.
- numPoints - The number of points to use in the chain, minimum of 2, no maximum.
- index - The index of the point to set, if it equals numPoints-1 then the shape will be created
- loop - 1=connect this back to the first point creating a loop, 0=leave this point hanging on the end (default)
- x - X position for the specified point.
- y - Y position for the specified point.