kingyo
Member
IDE v2.3.4.580 / runtime v2.3.4.442
Sprite animations do not work as expected.
The code below expects the image_index to stop at 5, but it stops at 4.
What could be wrong with this code?
Is it a specification that this code does this? Is it a bug or something else?
Note
I know there are other simple ways to stop at frame 5. However, for some reason, I am using code like this. The explanation of the reason is omitted.
A sprite with frames from 0 to 5 is used.
Sprite animations do not work as expected.
The code below expects the image_index to stop at 5, but it stops at 4.
What could be wrong with this code?
Is it a specification that this code does this? Is it a bug or something else?
Note
I know there are other simple ways to stop at frame 5. However, for some reason, I am using code like this. The explanation of the reason is omitted.
A sprite with frames from 0 to 5 is used.
GML:
Create event
image_speed = 0.2;
state = 0;
last_state = -1;
Step event
switch (state)
{
case 0:
if (image_index >= 5)
{
image_speed = 0;
state = 1;
}
break;
case 1:
if (state != last_state)
{
image_index = 5;
last_state = state;
}
break;
default: break;
}
Last edited: