sprite_get_speed


Syntax:

sprite_get_speed(index)

Argument Description
index The index of the sprite to get the speed of


Returns:

Real


Description

This function can be used to retrieve the sprite speed as defined for the sprite resource in the Sprite Editor. The value returned can then be used, for example, to calculate how many frames may be drawn for different image_speeds. Note that the return value will be very different depending on the type of speed that was applied in the Sprite Editor, either Frames Per Second, or Frames Per Game Frame. The following two examples illustrate this:

You can find out what the type of animation speed was used when defining the sprite using the function sprite_get_speed_type, and you can set the animation speed and type using the function sprite_set_speed.


Example:

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.