This function can be used to retrieve the sprite animation type as defined for the sprite resource in the Sprite Editor. The value returned will be one of the following constants:
Constant Description spritespeed_framespersecond The sprite was defined with animation in frames per second. spritespeed_framespergameframe The sprite was defined with in animation in frames per game frame.
The following two examples illustrate the difference this can make when calculating animation speeds for the sprite:
- If you have a sprite that draws 1 frame per second and set the image speed to 0.5 it will draw at 0.5 frames per second. If your game frame rate is 60 frames per second then the sprite will draw 1 frame for every 120 game frames.
- If you have a sprite that draws 1 frame per game frame and set the image speed to 0.5 it will draw 0.5 frames per game frame. If your game frame rate is 60 frames per second then the sprite will draw 30 frames for every 60 game frames.
|index||The index of the sprite to get the animation type of|
Constant (see above)
s_speed = sprite_get_speed(sprite_index);
s_type = sprite_get_speed_type(sprite_index);
The above code gets the sprite speed and the sprite animation type and stores them in instance variables for future use.