1
我使用下面的代碼添加將每1.5秒之後創建的精靈如下如何停止預定runAction在cocos2d
[self schedule:@selector(addTraget:) interval:1.5];
-(void)addTraget:(ccTime)dt{
CCSprite *target = [CCSprite spriteWithFile:@"img1.png" rect:CGRectMake(0, 0, 80, 36)];
target.position = ccp(-target.contentSize.width/2, 100);
[self addChild:target];
target.tag = 1;
id actionMove = [CCMoveTo actionWithDuration:actualDuration*2.5 position:ccp(winSize.width + (target.contentSize.width/2), actualY)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
id sequece = [CCSequence actions:delayTime1, calFun1, delayTime2, calFun2,actionMove, actionMoveDone, nil];
id repeate = [CCRepeatForever actionWithAction:sequece];
[target runAction:repeate];
}
的addTarget方法定那麼如何後停止這個計劃行動滿足條件後的一段時間?
您使用以下代碼的時間表。重複選項有 [self schedule:@selector(addTraget :) :) interval:1.5 repeat:NO delay:NO]; – Nims 2013-04-10 09:28:27
親愛的我想重複1分鐘或滿足條件之前...我通過[self unscheduleAllSelectors]得到了解決方案; – KsK 2013-04-10 09:32:26