i am spending a lot for my time for a simple things i think.I want to hide and show a sprite in scene.
myS = [CCSprite spriteWi开发者_运维技巧thFile:@"Background_Pause_pad.png"];
[myS setPosition:ccp(384,470)];
myS.opacity = 0;
[self addChild:myS z:1];
and when i need to appear it..
[myS runAction:[CCFadeIn actionWithDuration:1]];
and hide it
[myS runAction:[CCFadeOut actionWithDuration:1]];
but it does not work.....can anyone plz help??
- Why do you use a Sequence for one action ?
- You have to choose the animation you want !
- E.g : if you choose CCFadeIn
[mySprite runAction:[CCFadeIn actionWithDuration:0.5f]];
I think you can try the below stuff of the code. It would work for you
id action1 = [CCFadeIn actionWithDuration:1];
id action2 = [CCDelayTime actionWithDuration:1];
id action3 = [CCFadeOut actionWithDuration:1];
[myS runAction:[CCSequence actions:action1,action2,action3,nil]];
As you need the fadein fadeout action it would generate it and display the Same.
精彩评论