views:

8

answers:

0

Here is my code, i have been trying-

-(void) animatedMove:(CCSprite *)character 
{
    ccTime actualDuration = 10;
    id actionMove = [CCMoveBy actionWithDuration:actualDuration
                                        position:ccp(screen_width+50, character.position.y)];
    id actionBack = [CCMoveBy actionWithDuration:1
                                        position:ccp(50, screen_height/2)];
    id actionFinished = [CCCallFuncN actionWithTarget:self
                                            selector:@selector(animatedMoveFinished:)];
    [character runAction:[CCSequence actions:actionMove,actionBack,actionFinished,nil]];
}

-(void) animatedMoveFinished:(id)sender 
{
    CCSprite *character = (CCSprite *)sender;
    [self animatedMove:character];

    NSLog(@"( %.2f, %.2f", character.position.x, character.position.y);
}

its moving the character out of screen and not reinitializing to the start position.