Detecting End of Animation
Posted
by
Will
on Game Development
See other posts from Game Development
or by Will
Published on 2012-02-27T15:17:37Z
Indexed on
2012/03/29
5:42 UTC
Read the original article
Hit count: 420
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
© Game Development or respective owner