Detecting End of Animation
- by Will
So I am making a death animation for a game. enemy1 is a UIImageView, and what I'm doing is when an integer is less than or equal to zero, it calls this deathAnimation which only happens once. What I want to do is use a CGPointMake right when the animation is finished being called. Note that before the deathAnimation is called, there is another animation that is constantly being called 30 times a second. I'm not using anything like cocos2d.
if (enemy1health <= 0) {
[self slime1DeathAnimation];
//How can i detect the end of this animation
}
This is how the animation is done
-(void)slime1DeathAnimation{
enemy1.animationImages = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"Slime Death 1.png"],
[UIImage imageNamed:@"Slime Death 2.png"],
[UIImage imageNamed:@"Slime Death 3.png"],
[UIImage imageNamed:@"Slime Death 4.png"],
[UIImage imageNamed:@"Slime Death 5.png"],
nil];
enemy1.animationDuration = 0.5;
enemy1.animationRepeatCount = 1;
[enemy1 startAnimating];
}
If you need more code just ask