fishBallet
Member
Hi, I have a sprite with 6 frames. I'm trying to reverse its animation whenever image_index hits 0 or 5.
So to clarify, the sprite's frames should display the following: 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5...
The code I currently have was previously working fine, but now causes the sprite to display indexes 0-5, then flickers between 0 and 5.
What would be a better solution?
I have also tried this with the same Create event above, but the sprite doesn't move at all. I'm thinking it's because it's constantly switching between image_speed 1 and -1.
So to clarify, the sprite's frames should display the following: 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5...
The code I currently have was previously working fine, but now causes the sprite to display indexes 0-5, then flickers between 0 and 5.
What would be a better solution?
Code:
//Create:
image_speed = 1;
//Animation End:
image_speed *= -1;
I have also tried this with the same Create event above, but the sprite doesn't move at all. I'm thinking it's because it's constantly switching between image_speed 1 and -1.
Code:
//Step:
if (floor(image_index) == 5 || floor(image_index) == 0) image_speed *= -1;