Sprites

Game Maker 8

Sprites

The following functions will give you information about a sprite:

sprite_exists(ind) Returns whether a sprite with the given index exists.
sprite_get_name(ind) Returns the name of the sprite with the given index.
sprite_get_number(ind) Returns the number of subimages of the sprite with the given index.
sprite_get_width(ind) Returns the width of the sprite with the given index.
sprite_get_height(ind) Returns the height of the sprite with the given index.
sprite_get_xoffset(ind) Returns the x-offset of the sprite with the given index.
sprite_get_yoffset(ind) Returns the y-offset of the sprite with the given index.
sprite_get_bbox_left(ind) Returns the left side of the bounding box of the sprite with the given index.
sprite_get_bbox_right(ind) Returns the right side of the bounding box of the sprite with the given index.
sprite_get_bbox_top(ind) Returns the top side of the bounding box of the sprite with the given index.
sprite_get_bbox_bottom(ind) Returns the bottom side of the bounding box of the sprite with the given index.
In certain situations you might want to save the bitmap corresponding to a particular subimage of the sprite to a file. For this the following functions can be used:

sprite_save(ind,subimg,fname) Saves subimage subimg of sprite ind to the file with the name fname. This must be a .png file. Only available in the Pro Edition.
sprite_save_strip(ind,fname) Saves all subimages of sprite ind as a strip to the file with the name fname. This must be a .png file. Only available in the Pro Edition.