You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In practical situations, swapping sprite_index multiple times a frame will make image_index loop based on the one with the fewest frames since it loops instantly on swap. This can catch people off-guard and be very difficult to debug if you don't know this behavior exists.
I was not able to find any place that this is documented, since the current sprite_index page says:
"Changing the sprite does not change the index of the currently visible frame, so if you change the sprite on frame number 3, the new sprite will be drawn with that frame visible (assuming it has the same number of frames)."
But doesn't say what happens if the new sprite does NOT have the same number of frames, and instead has less frames.
YYDan
changed the title
The fact that sprite_index will instantly loop image_index when changed is not documented
Manual Content: sprite_index page needs to say setting a new sprite with fewer frames causes image_index to reset to 0
Feb 22, 2024
In practical situations, swapping sprite_index multiple times a frame will make image_index loop based on the one with the fewest frames since it loops instantly on swap. This can catch people off-guard and be very difficult to debug if you don't know this behavior exists.
I was not able to find any place that this is documented, since the current sprite_index page says:
"Changing the sprite does not change the index of the currently visible frame, so if you change the sprite on frame number 3, the new sprite will be drawn with that frame visible (assuming it has the same number of frames)."
But doesn't say what happens if the new sprite does NOT have the same number of frames, and instead has less frames.
Description
If you do something like this
This will show
3
0
0
In practical situations, swapping sprite_index multiple times a frame will make image_index loop based on the one with the fewest frames since it loops instantly on swap. This can catch people off-guard and be very difficult to debug if you don't know this behavior exists.
I was not able to find any place that this is documented, since the current sprite_index page says:
"Changing the sprite does not change the index of the currently visible frame, so if you change the sprite on frame number 3, the new sprite will be drawn with that frame visible (assuming it has the same number of frames)."
But doesn't say what happens if the new sprite does NOT have the same number of frames, and instead has less frames.
Manual Link
https://manual.gamemaker.io/monthly/en/index.htm#t=GameMaker_Language%2FGML_Reference%2FAsset_Management%2FSprites%2FSprite_Instance_Variables%2Fsprite_index.htm
The text was updated successfully, but these errors were encountered: