Menu

Sprite Sheets


The SPRITE object is designed to use a sprite sheet as the source image. The X and Y controls refer to the source rectangle of the image. It is expected that the source image will be larger than the specified width and height of the target image. The X and Y controls are multiplied by the Width and Height properties of the SPRITE object. Therefore, if you have a SPRITE object with a Width of 80 and Height of 60 and you pass it an X value of 2 and a Y value of 1 then it will draw a sprite on the screen at the static location specified, but the source of the image will be a rectangle of size 80×60 at location (160, 60) inside the source image.

Please note that unlike other graphics objects that will use the default image size when no width or height is specified, the sprite sheet requires that a width and height be entered in order to properly calculate the source rectangle.

The following simple example uses a sprite sheet to step through the alphabet from A to P.

CANcreate Design:

 
CANcreate Image Pack: