gml - Sprite in Game Maker doesn't act the way I want it to -


i'm working on animating player behaves he's breathing.

if(time mod 60==0){    if(image_index==0){      image_index=1;    }    else{      image_index=0;    } } time++; 

the whole thing put in step event , sprite changing every single step , changes index 2 , 3, haven't used in code.

so if has ideas why work please tell me.

it because sprite use has multiple sub-images. gamemaker naturally iterate image index every frame. first, need stop animation running with

image_speed = 0; 

you have run line when sprite has been changed, ideally after "sprite_index" variable changed. if don't change it, set image_speed 0 in creation code.

if curious, found answer here : how freeze sprite animation on last frame?


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -