I have a node with a picture of a box added right on top of another node with image of an airship:
SKSpriteNode *box = [SKSpriteNode spriteNodeWithImageNamed:@"Box"];
box.position = airshipNode.position;
box.physicsBody = [SKPhysicBody bodyWithRectangleOfSize:box.size];
box.physicsBody.categoryBitMask = 1;
box.physicsBody.collisionBitMask = 0;
box.zPosition = airship.zPosition - 1;
[box setScale:0.7];
Now I added a label on top of the box:
SKLabelNode *label = [SKLabelNode labelNodeWithFontNamed:@"Arial"];
CGPoint *position = box.centerRect.origin;
position.y -= 55;
label.position = box.centerRect.origin;
label.text = @"a";
label.fontSize = 70;
label.fontColor = [SKColor blackColor];
Then I added the label onto the box and box onto the main scene:
[box addChild:label];
// self is the main scene.
[self addChild:box];
Then I call these code every 1 second. But the label only appears on some of them and the others are just the box, no label. I also added a fade out action for when the box was tapped. But when the fade out animation is going, the label on the box without the text starts to appear. Any ideas on why the label is not appearing on initializations? Thanks.