image_speed - animation speed of a sprite.
( Game Maker 6.1, 7 )
Description
image_speed is the animation speed of a sprite.
The value of image_speed is added to the image_index of the instance every step.
When the image_index reaches a new whole number, then the next frame is displayed. Thus, if image_speed is set to 1, the next subimage will be displayed every step.
To illustrate, if image_index was set to 0 and image_speed were set to 0.3, then this is what would happen.
STEP 1 : image_index is 0.3, displaying image 0
STEP 2 : image_index is 0.6, displaying image 0
STEP 3 : image_index is 0.9, displaying image 0
STEP 4 : image_index is 1.2, displaying image 1
STEP 5 : image_index is 1.5, displaying image 1
etc..
Examples
GML Code Examples
Start the Animation of a Sprite
This will cause a subimage to be displayed every two steps.
image_speed = 0.5;
Stopping the Animation
image_speed = 0;
In this example, image_speed is set to 0, thus causing the animation of subimages to stop on whatever image it was on. If you want to manually change which subimage is displayed with image_index, set image_speed to 0 at in the Create event of the object.
Related Pages
Actions That Can Change sprite_index
Other
| Categories: GML : Graphics : Sprites : Variables |