ccfollow actions in cocos2d
- by Srinivas
ccfollow actions is following my projectile correctly. when, double tap recognised.
see the below code. were am mistaken.
here is my code:-
- (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]];
}
}
after seen the above code. a question raised by you.
why am mentioning the ccfollow action in if condition.
answer is here,
ordinarily, am mention in update function it will not works, when i set this if condition it works after double tap recognised.
how to rectify this issue?
any help would be highly appreciated.