I used GameMaker 6 and 7 a lot when I was younger and have only recently gotten back into it, to help a friend who is trying to learn version 8.1. He came across a strange problem (well strange to me at least) where changing the sprite_index would reset the image_speed immediately. In my own little test, I ran this code in the step event of an object with an animation of 100 frames:
if(image_index == 20)
{
//sprTest2 is only a 10 frame animation.
sprite_index = sprTest2;
show_message(image_index);
}Sure enough, the show_message displayed 0 as the image_index where as it had just been 20, 2 lines before. Does this mean that instead of just assigning a new sprite index to the variable sprite_index, GameMaker is actually running a function of sorts each time it sees the assignment? This is the help file entry for sprite_index:
sprite_index This is the index of the current sprite for the instance. You can change it to give the instance a different sprite. As value you can use the names of the different sprites you defined. Changing the sprite does not change the index of the currently visible subimage.
So according to the manual, this shouldn't happen. Is this a newly implemented feature that I missed while I was away?
Thanks for any enlightenment you might be able to offer this confused soul,
Maythe















