So, in my code I have a method that spawns an asteroid. Hurray!
- (void)spawnAsteroid {
Asteroid *ast = [Asteroid initWithAsteroid];
ast.tag = 3;
int x = arc4random() % 480;
CGPoint endPos = CGPointMake(x, -10);
[ast runAction:[CCSequence actions:
[CCMoveTo actionWithDuration:4.0 position:endPos],
[CCCallFuncN actionWithTarget:self
selector:@selector(spriteDone:)],
nil]];
[self addBoxBodyForSprite:ast];
[self.parent addChild:ast];
}
I am using Box2D for my Collision Detection, hence the "addBoxBody..." method there at the end. But in another method, I'm having some issues with memory management, so I want to ask some clarifying questions. In my runAction call here, I have it do:
[CCCallFuncN actionWithTarget:self selector:@selector(spriteDone:)]
This runs after the first CCMoveTo is over. But what if the asteroid doesn't reach the end of the move to? I can blow up asteroids, in which case they are removed (RemoveChild), so does that method ever run? Does spriteDone Method get called?