# LoadSprite

## Description

Creates a sprite in a blank sprite ID with an explicit image to use when rendering, it returns the sprite ID used.
By default sprites are created with a depth of 10, are sized using the given image as a guide, and positioned at 0,0 using their top left corner.
If the assigned image has alpha pixels the sprite is create with a transparency mode of 1, otherwise it uses a transparency mode of 0 (opaque) This command takes an image file name and loads it specifically for this sprite, this image will be deleted when the sprite is deleted. If lots of sprites are going to use the same image you should load the image separately and pass its ID to the CreateSprite command to save memory.

## Definition

integer LoadSprite( imagefile )

UINT agk::LoadSprite( const char* imagefile )

LoadSprite( iSpriteIndex, imagefile )

void agk::LoadSprite( UINT iSpriteIndex, const char* imagefile )

## Parameters

- imagefile - The file name of the image to use when drawing this sprite
- iSpriteIndex - The sprite ID to use to reference this sprite later (separate from image IDs, so there can be both a sprite 1 and an image 1)