Sprites are a powerful way to combine a number of game concepts in an easy to use package, this will show you how you can use Sprites.
Sprites encapsulate a lot of the functionality required in a game environment. A sprite has at it's simplest a position, a vector, and an animation. However a sprite can also store other game-related data like mass, layers, and collision kind. A list of CreateSprite overloads as well as various functions that can be applied to a sprite can be found in the API.
A Sprites position can be set using the SpriteSetX and SpriteSetY procedures, these can be used to place the sprite into the game world. Similarly you can give the sprite a vector using SpriteSetDX and SpriteSetDY.
UpdateSprite will apply the Sprite's current vector to the Sprite's current position
A Sprite can also have an animation, the animation is automatically handled by the sprite. All that you have to do is start the animation and every update cycle the sprite will automatically update the animation. It will also apply any information stored in the animation to the sprite, for example if a frame has a velocity it will be applied to the sprite.
UpdateSprite will call UpdateAnimation on the sprite's current animation if it has one
Sprites also have layers, these allow you to change what the sprite looks like by removing or adding image layers. This can be useful for changing what a character looks like because you can hide or add layers when certain circumstances occur. For example, when a character picks up a sword you might want to make the character hold it. To do this you just need to add the layer with the sword using SpriteAddLayer and it will draw the sword in next time DrawSprite is called.
Every layer is drawn in order from layer 0 to the highest layer every time DrawSprite is called