image_speed (Game Maker)


( Game Maker 6.1, 7 )

image_speed - animation speed of a sprite.


image_speed is the speed at which a sprite animates. Actually, 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 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


Example of Use

image_speed = 0.5;

This will cause a subimage to be displayed every two steps.

Stopping the Animation

image_speed = 0;

In this example, image_speed is set to , 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 at in the Create event of the object.

Related Pages

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.