I don't know why, but score label node dissapears after first round.I have two scores, one for human ,other for computer :
-(void)scoreCount{
if(scoreLabel == nil){
NSString* scoretxt =[NSString stringWithFormat:@"0"];
[scoreLabel setText:scoretxt];
scoreLabel = [SKLabelNode labelNodeWithFontNamed:@"ROTORcapExtendedBold"];
scoreLabel.fontSize = 65.f;
scoreLabel.fontColor = [UIColor grayColor];
scoreLabel.position = CGPointMake(CGRectGetMidX(self.frame)/2,CGRectGetMaxY(self.frame)-70);
scoreLabel.zPosition = -1;
[self addChild:scoreLabel];
}
scoreLabel.text = [NSString stringWithFormat:@"%ld",(long)score];
if(scoreLabelCom == nil){
NSString* scoretxtcom =[NSString stringWithFormat:@"0"];
[scoreLabelCom setText:scoretxtcom];
scoreLabelCom = [SKLabelNode labelNodeWithFontNamed:@"ROTORcapExtendedBold"];
scoreLabelCom.fontSize = 65.f;
scoreLabelCom.fontColor = [UIColor grayColor];
scoreLabelCom.position = CGPointMake(CGRectGetMidX(self.frame)+(CGRectGetMidX(self.frame)/2),CGRectGetMaxY(self.frame)-70);
scoreLabelCom.zPosition = -1;
[self addChild:scoreLabelCom];
}
scoreLabelCom.text = [NSString stringWithFormat:@"%ld",(long)scoreCom];
}
this method is called every time somebody is getting a point, and I put in
-(void)update:(CFTimeInterval)currentTime {
[self scoreCount];
}
because, without it scoreCount wont show 0 points, but only show up after first point, but, when new round starts, ScoreCout wont show up at all. how can I correct it? And why it is happening?