Fixes issues regarding subimage index

Reporter: RobertBColton  |  Status: open  |  Last Modified: September 24, 2016, 01:12:56 AM

So not only does GM 5 and GMS allow the image_speed to be negative it also allows you to animate draw_sprite when passing a negative subimage.

draw_sprite(sprite, -2, 0, 0); for example should update image_index. My change here allows the image_index to be updated when no sprite is assigned to the object and makes ENIGMA behave the same as GMS.

The minor difference between ENIGMA/GMS and GM 5 is that GM 5 will not mod image_index when you have a negative image_speed or otherwise and even when a sprite is assigned to the object.

So ENIGMA will behave like GMS and mod the image_index only when a valid sprite is assigned to the object (it can't if there isn't one because sprite_get_number crashes when passed a non-existant sprite).

This further addresses issues reported in #865

JoshDreamland  
Personally, I think this is just a dumb thing to do. If you just want a counter, write a counter; don't expect the engine to increment an index it's not using, ad infinitum. I don't think we should encourage reliance on this sort of behavior.

RobertBColton  

This one I really don't care about, I would have never even expected that to be a feature. Especially the whole negative subimage index. So it's not clear behavior to an advanced or novice GameMaker user and thus I doubt anybody actually relies on it or ever did. Anyway this one is your call we can just leave it here until some game needs it or you can make the decision. I really just sent this one so that it's documented and to make everyone aware of it.

Please sign in to post comments, or you can view this issue on GitHub.