开发者

can I add same ccspirit object after remove it?

I have total 20 images in NSMutableArray of ccspirit objects, and I want to show them on screen moving moving upward, I add them to as [self addChild:p] as below

-(void) callMethod {
static int x = 50;  
if (x>=0) {
Paddle  *p = [paddlesFruits objectAtIndex:x];
p.position = CGPointMake(40,0);
[self addChild:p];
[self moveMethod1: p];
[p release];
x--;
}else {
    x=50;
}
}

and the method which will move it upside is

-(void) moveMethod1 : (id) sender {

id actionMove2 = [CCMoveTo actionWithDuration:6 position:ccp(40, 520)];

id actionMoveDone2 = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];

[sender runAction:[CCSequence actions:actionMove2, actionMoveDone2, nil]];

}
-(void)spriteMoveFinished:(id)sender {
//NOTHING HERE 
}

but after using addChild again and agai开发者_高级运维n, it will make it heavier, so what should I do, I am thinking to addChild and remove after certain time, I will removeChild, but is it possible to to add a ccspirit again after using removeChild for same ccspirit object?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜