This variable returns the index of the current sprite for the
instance, or -1 if the instance has no sprite associated with it.
You can change it to give the instance a different sprite by giving
it the name of a sprite from the resource tree or by using a
variable that has an externally loaded sprite indexed in it.
Changing the sprite does not change the index of the currently
visible sub-image, so if you change the sprite on sub-image number
3, the new sprite will be drawn with that sub-image visible
(assuming it has the same number of sub-images).
if !collision_line(x, y, other.x, other.y, obj_Wall, false, true)
sprite_index = spr_spotted;
sprite_index = spr_clear;
The above code will loop through all instances of "obj_Check" checking for a collision line between them and the instance running the code. The sprite of those instances will be changed depending on the return value (true or false) for the collision line.