0
votes

I have used

image.animationImages = [NSArray arrayWithObjects:
                             [UIImage imageNamed:@"image1"],
                             [UIImage imageNamed:@"image2"],
                             [UIImage imageNamed:@"image3"],
                             [UIImage imageNamed:@"image4"], nil];


[image setAnimationRepeatCount:1];
image.animationDuration = 1;
[image startAnimating];

but it gives a flip book effect to the animation. What I am looking for is a smooth animation to set each image at given time. I have currently is NSTimers to trigger a method then I have code within the method to set a image and another NSTimer to set another image which is in a method so fourth. It gives the animation I am looking for but the problem I am facing is that I am developing a game and I want when the user pauses the game it stops on the current image it is on. The game runs on a NSTimer which triggers a method. All I do to pause the game is to invalidate the NSTimer.

What approach should I take?

1

1 Answers

0
votes

you should add NSTimer and user_flag input.
This user_flag input you can declare as static int user_flag = 0 and when you are doing stop then simply make this variable as user_flag = 1.

Now implement the logic in all this condition that will look something like this one :

if(NSTimer_obj == condition && user_flag == 0)
{
       //your code...

}