3

Hi I'm using a custom font on a SKLabelNode.

I'm able to set the font colour but ok, but the inner parts of the text, are transparent.

Is there a way i can set this colour to white for example?

my code so far

    scoreLabel.fontColor = [SKColor colorWithRed:0.0 green:0 blue:0.0 alpha:1.0];

a busy cat

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
user1216855
  • 275
  • 1
  • 4
  • 12
  • You can use another font which looks the same (without the 3d effect) and superimpose it on this label. – ZeMoon Apr 24 '14 at 06:16

1 Answers1

3

The easiest way I found is to combine an SKSpriteNode and a SKLabelNode. You simply add the SKLabelNode as a child to the SKSpriteNode.

    SKLabelNode *label = [[SKLabelNode alloc]initWithFontNamed:@"Courier"];
    label.text = @"blah";
    label.fontColor = [UIColor blueColor];

    SKSpriteNode *background = [SKSpriteNode spriteNodeWithColor:[UIColor whiteColor] size:CGSizeMake(label.frame.size.width, label.frame.size.height)];
    background.position = CGPointMake(200, 100);
    [background addChild:label];
    label.position = CGPointMake(0, -label.frame.size.height/2);

    [self addChild:background];

The result looks like this... enter image description here

maelswarm
  • 1,163
  • 4
  • 18
  • 37
  • Or do you just mean set the color as white in the inner parts of b and a? – maelswarm Apr 23 '14 at 20:20
  • close, i've added an example image to my question. So the white part of the text should be as displayed, however in mine it is yellow, as if transparent! – user1216855 Apr 23 '14 at 20:32