Reputation: 3296
I want to scale my sprite using CCScaleTo.
Here is my code :
CCSprite *spritePauseScreen =[CCSprite spriteWithFile:@"resumeGameScreenBG.png"] ;
spritePauseScreen.position= ccp(winSize.width/2,winSize.height/2);
spritePauseScreen.scale=0.5f;
[spritePauseScreen runAction:[CCScaleTo actionWithDuration:0.6 scaleX:1.0f scaleY:1.0f]];
[self addChild:spritePauseScreen z:7];
Its not working. The sprite is shown on scale value of 0.5 only. It does not get scaled up to 1.0 Please help?...
Upvotes: 0
Views: 240
Reputation: 4329
Try This Code.
int delayTime = 0.3f;
CCSprite *each = [CCSprite spriteWithFile:@"Icon.png"];
each.position = ccp(160,240);
each.scaleX = 0.0f;
each.scaleY = 0.0f;
CCAction *action = [CCSequence actions:
[CCDelayTime actionWithDuration: delayTime],
[CCScaleTo actionWithDuration:0.5F scale:1.0],nil];
delayTime += 0.2f;
[each runAction: action];
[self addChild:each];
Upvotes: 3