开发者

How to hide the label (CCLabel) after a certain time in cocos2d?

I added a label by using CCLabel to my layer. Now I want it do disappear after some time like (2sec). How can I make it t开发者_如何学JAVAo disappear?

CCLabel *labelPerfectDraw = [CCLabel labelWithString:@"Perfect Draw" fontName:@"Marker Felt" fontSize:30 ];
        labelPerfectDraw.color = ccc3(0x00, 0x00, 0xff);
        labelPerfectDraw.position = ccp(windowSize.width/2, windowSize.height/2+80);
        [self addChild:labelPerfectDraw];

I added label in above way. Please give me the idea how can I work on it?


There is a visible property for CCLabel instances as they are derived from CCSprite. That should do it. Just set it to false or rather you want it to disappear after 2 seconds so create a function attached to a timer which sets visibility to false.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜