Pop Up Animation in Cocos2D game
I want to create one game scene to make some object like pop up randmoly.. It shows to small when appear in screen at any time and any position.. It goes to big and come out to screen..
GameScene with objects shows pop up in screnn randmoly..
Like one game which has objects appear in jumping animation..
How its possible..? Any help should be appreciated.. Please...
To do those animations u must be in mind that the z value of your animated sprite should be higher the all the others to be always up front (create constants to that) You are going to use CCAction do create the action like, fadeIn, Scale, Move.
This is a sample of an viking poping up in the screen and like
CCSprite *viking = [CCSprite spriteWithFile:@"VikingFloating.png"]; [viking setPosition:ccp(screenSize.width * 0.35f, screenSize.height * 0.45f)]; [self addChild:viking]; id rotateAction = [CCEaseElasticInOut actionWithAction: [CCRotateBy actionWithDuration:5.5f angle:360]]; id scaleUp = [CCScaleTo actionWithDuration:2.0f scale:1.5f]; id scaleDown = [CCScaleTo actionWithDuration:2.0f scale:0.5f]; [viking runAction:[CCRepeatForever actionWithAction: [CCSequence actions:scaleUp,scaleDown,nil]]]; [viking runAction: [CCRepeatForever actionWithAction:rotateAction]];
there is a great book about it, in fact i've got this piece of code from it - http://cocos2dbook.com/