How to show more than one animation in sequence in Cocos2D?

By | March 25, 2011

For showing a number of animations sequentially in Cocos2D we use the CCSequence.
CCSequence can accept a number of actions as parameters which will be executed in sequence , ie one after another.
Here is a sample code to so this.

        /*  This action will scale my_sprite */
        id scaleTo = [CCScaleTo actionWithDuration:4 scale:1.5];
        /*This action will move the sprite from current position to this point*/
        id moveTo = [CCMoveTo actionWithDuration:1.0f
        /* This will execute all the above actions in sequence. */
	id sequence=[CCSequence actions:scaleTo,moveTo,nil];
	/* Run the above actions for your sprite */
        [my_sprite runAction:sequence];

Leave a Reply

Your email address will not be published. Required fields are marked *