ccfollow actions in cocos2d

Posted by Srinivas on Stack Overflow See other posts from Stack Overflow or by Srinivas
Published on 2010-12-27T11:48:13Z Indexed on 2010/12/27 11:54 UTC
Read the original article Hit count: 180

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocos2d