close

 How can I add text or characters into a Sprite

from http://stackoverflow.com/questions/3402825/adding-text-into-a-sprite

How can I add text or characters into a Sprite. If it's not possible, is there any alternative to get the same effect?

NOTE: I am using COCOS2D framework.

EDIT:

I have tried in this way-

CCLabel* label =[[CCLabel alloc] initWithString:@"H!" dimensions:CGSizeMake([spriteObj contentSize].width,[spriteObj contentSize].height)  alignment:UITextAlignmentCenter fontName:@"verdana" fontSize:15.0f];
//label.position = newBubble.position;//ccp([spriteObj contentSize].width/2, [spriteObj contentSize].height/2);
[spriteObj addChild:label z:10];

It shows the text 'H!' at the bottom left corner of the sprite.

 
arrow
arrow
    全站熱搜

    zer931 發表在 痞客邦 留言(0) 人氣()