How to freeze sprite animation on last frame?

2019-08-09 03:10发布

I want to make a sprite in game maker that contains 5 sub images to stop when it reaches the last one how can I do this using code?

2条回答
我想做一个坏孩纸
2楼-- · 2019-08-09 04:00

In Animation End event:

image_speed = 0;
image_index = image_number - 1;
查看更多
劳资没心,怎么记你
3楼-- · 2019-08-09 04:07

Run this in the Step even of your object:

If image_index == 4 Then image_speed = 0;

image_index is the index of the current frame in the object's sprite's animation, image_speed is the speed of the animation (in frames per step). This code just checks if the animation is at the final frame (the frames are 0-indexed, so the 5th frame is index 4.), and if so sets the speed to 0.

查看更多
登录 后发表回答