WreckingPrograms
Member
We've just now upgraded our project to GMS 2.3, but sadly a lot of features broke for us because of a seemingly undocumented change that was made to the image_index variable. It appears that image_index is now forced to stay within the bounds of the sprite; that is, if the sprite has 4 animation frames and image_index would become greater than or equal to 4, it would automatically be changed back to 0. This makes code like this no longer function:
You're probably thinking of just using image_speed instead, but that only actually updates image_index at the end of the frame. Modifying image_index directly gives us exact control over where in the code we want to progress the animation. But since image_index can no longer be greater or equal to image_number, nearly all instances of manually altering image_index no longer function as intended.
I'm unsure if this was an intentional change by YoYo. If so, this seems like a weird and unnecessary limitation to me. It forces you to use image_speed, which gives you no control over the time that the animation is updated, and the old image_index would still draw sprites just fine if it exceeded image_number - it would internally apply this "value looping" when drawing something, but without affecting the image_index variable itself.
Does anyone know if there's a way around this, or if this is intended behaviour in the first place? Going back and changing all code structured like this is sadly not an option because of the size of our project.
GML:
image_index += 0.2;
if image_index >= image_number
{
// Do something when the animation ends
}
I'm unsure if this was an intentional change by YoYo. If so, this seems like a weird and unnecessary limitation to me. It forces you to use image_speed, which gives you no control over the time that the animation is updated, and the old image_index would still draw sprites just fine if it exceeded image_number - it would internally apply this "value looping" when drawing something, but without affecting the image_index variable itself.
Does anyone know if there's a way around this, or if this is intended behaviour in the first place? Going back and changing all code structured like this is sadly not an option because of the size of our project.