Use of sprites for character animation

Posted by: Ipod  :  Category: Software development

Another specific object Layer, provided in the Game API, is a Sprite.
In a sense, Sprite is the conceptual inverse of TileLayer.
While TiledLayer uses a palette of elements of the original image to create a big scene,
Sprite uses a sequence of frames of the original image for animation.

All you need to create an object Sprite – the original image and the size of each frame.
In TiledLayer original image is divided into equal-sized elements, elements in the Sprite images are called frames.
In the example below to create a Sprite object with a frame size of 32 x 32 pixels using the original image tank.png.