Home › Forums › General Discussion › CCLabel background color
Tagged: background, CCLabel, transparent
| Author | Posts |
|---|---|
| Author | Posts |
| November 19, 2010 at 7:04 pm #248 | |
| stahlmanDesign | I want to make my characters display a message when spoken to or when the hero is in the vicinity, so I added a CCLabel that appears about the characters and follows them around. The problem is that I can’t make the background transparent. What seems to happen is that when the CCLabel is first created, it samples the background around the text box to create a sprite. In my example screen shot the Skeleton and Spider started on a yellow background and you can see how they carry that original yellow wherever they go. Even if the background is transparent in Tiled, meaning it’s black in the game, the sampled area in the CCLabel is black and not transparent. I’m using CCLabel because it’s not “slow” as is commonly believed unless you are updating it constantly. But maybe that’s what I must do if it’s going to be moving around. In that case I guess I’d need to use CCLabelAtlas or CCBitmapFontAtlas instead. Is there a way to make it transparent without updating it constantly ? |
| November 19, 2010 at 7:11 pm #880 | |
| CyberGreg | Check out CCNotifications -> LINK It’s now a part of cocos2d 0.99.5 rc and up. Manucorporat developed it mainly for OpenFeint notifications but it works great as an all-purpose animated window. Oops sorry, to get rid of the black you need to make your own CCLabel extension just like CCZSprite. I made mine with CZLabelBMFont. |
| October 1, 2011 at 11:16 am #2080 | |
| Pete | Justin, did you ever resolve this? When I display text using CCLabelBMFont, the lowest level in Tiled is being displayed as a background to the text (black if it’s transparent, green if it’s grass etc). Any help much appreciated! |
| December 23, 2011 at 11:29 pm #2229 | |
| Pete | CyberGreg, could you post the core code for your CZLabelBMFont please? I’ve looked at CCZSprite but I just can’t get my head around it at the moment (I’ve tried sleeping on it too, and that does usually work, but not this time). :) |
| December 24, 2011 at 9:30 am #2231 | |
| CyberGreg | Just like CCZSprite ;-) |
| December 25, 2011 at 8:42 pm #2234 | |
| Pete | Haha – thanks, I thought it must’ve changed. I’ll take another look, at least I can eliminate that now – cheers. |
You must be logged in to reply to this topic.