Help with Image Speed and Index

D

doodlebaron

Guest
I have an object that I want to stop animating once it hits the 3rd frame. I wrote code that I though would work, but the image_speed does not change upon hitting the 3rd frame. Here's what I wrote:

if (image_index=2) image_speed=0; else image_speed=0.3;

It does not work. Please help! Thanks.
 

jo-thijs

Member
Hi and welcome to the GMC!

With image_speed set to 0.3, image_index jumps from 1.8 to 2.1, skipping the index 2.
You should rather do this:
Code:
if image_index >= 2 {
    image_speed = 0;
    image_index = 2;
} else
    image_speed = 0.3;
 
B

bojack29

Guest
Code:
if (floor(image_index) == image_number - 1){
     image_speed = 0;
}else{
     image_speed = 1;
}
 
Top