sprite_index
From YoYoGames Wiki
Description
(real): the index value (id) of the currently used sprite for the object
- Read-write
- Scope: Local
Explanation
The sprite_index local variable is the variable that defines the Sprite that the object is currently using. When no sprite index is selected for an object, the value of -1 is assigned to sprite_index.
The variable sprite_index contains a real value and not a string value.
Examples
Since it is hard to memorize index numbers for each sprite, Game Maker automatically converts any sprite name used outside a comment or a string into a real number, which is the sprite index.
Therefore:
sprite_index=spr_player;
Would assign the the sprite spr_player to object this code has been performed with.

