ccfollow 动作正确地跟随我的弹丸。当,双击识别。
请参阅下面的代码。我错了。
这是我的代码:-
- (void)update:(ccTime)dt {
if (numTaps==1 ) {
[self runAction:[CCFollow actionWithTarget:nextProjectile worldBoundary:CGRectMake(0,0,1050,350)]];
}
}
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
numTaps = [[touches anyObject] tapCount];
printf("Tapcount : %d",numTaps);
if (numTaps ==1) {
nextProjectile = [[CCSprite spriteWithFile:@"Weapon.png"] retain];
nextProjectile.position = ccp(nextprojectile .contentSize.width/2+65, nextprojectile.contentSize.height/2+70);
[nextProjectile runAction:[CCSequence actions: [here's my nextprojectile actions],nil]];
}
}
看到上面的代码后。你提出的一个问题。为什么在 if 条件下提到 ccfollow 操作。
答案就在这里,通常,我在更新功能中提到它不起作用,当我设置这个如果条件它在双击识别后起作用。
如何纠正这个问题?
任何帮助将不胜感激。