• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker [Solved] how to change image_index for a drawn sprite?

T

tobiasgjerstrup

Guest
hello guys. I was wondering how you change the image index for a sprite that you draw (not the sprite associated with the object)
 

Neptune

Member
You can change the built-in variable 'image_index' a lot of ways.
Code:
image_index = 3; // Set to 3 (the 4th image of your sprite, because the first frame is 0)
image_index ++; //Increment by 1
image_index --; //Decrement by 1
image_index += 3; //Increment by 3
Note the built in variable 'image_speed' will cycle the variable 'image_index' on its own, unless you set
Code:
image_speed = 0;
 
Top