Returns the number of sub-images in a sprite.



Argument Description
index The index of the sprite.

Returns: Real


A sprite has to have at least one sub-image and this function will return just how many it has. Remember, a sprite sub-image starts being numbered from 0, so if this function returns 3 (the sprite being checked has 3 sub-images) they will be numbered 0, 1 and 2.


image_index = floor(random(sprite_get_number(sprite_index)));

The above code will set the image index to a random frame based on the number of sub-images that the sprite has.

Back: Sprites
Next: sprite_get_width
© Copyright YoYo Games Ltd. 2018 All Rights Reserved