GM: image speed

From GMpedia.org Wiki

Jump to: navigation, search
The correct title of this article is image_speed. It appears incorrectly here because of technical restrictions.

image_speed

Type: variable
Globalism: Local
Editable: Yes

The image_index local variable is the variable that defines the speed that the sub-image of an object's sprite progresses. Each sprite could have an number of images greater than 1, and the object 'animates' by moving a ceratin number of images per step.

[edit] Definition

Strictly speaking its "definition", image_speed is the number added to the current image index on each step. But this does not explain what does it do.

[edit] What does it do

Game Maker automatically increments the value image_index (and image_single in pre-6.x versions, but with conditions) of image_speed itself, then wraps the value around the maximum number of images, so if a sprite has 30 images, and the number 34 is reached, it is automatically turned into 4.

[edit] Conditions of incrementing image_single in pre-6.x versions

The image_single variable is incrmented then wrapped around the maximum number of existing images in the sprite, however, unlike image_index, when image_single is equal to -1, it is not incremented at all.

Personal tools