OK. I will say this again. Accessors are your friends. Use them. Always. NOTE: Yes I know Apple recommends not using them in init and dealloc but in 15 years, this has NEVER once caused an issue for me and NOT using them has. As in this case. There are times when you do NOT want to use them, but those times are much less than the times you DO want to use them.)
In your buttonText method:
- (void)buttonText:(int)number
{
lifeChange = [NSNumber numberWithInt:number];
NSString *text = [[NSString alloc] initWithFormat:@"%d", number];
CCLabel *label = [CCLabel labelWithString:text fontName:@"Times New Roman" fontSize:20];
label.position = CGPointMake(35, 20);
[self addChild:label];
}
You should be doing a:
- (void)buttonText:(int)number
{
NSString *text = [[[NSString alloc] initWithFormat:@"%d", number] autorelease];
CCLabel *label = [CCLabel labelWithString:text fontName:@"Times New Roman" fontSize:20];
[self setLifeChange:[NSNumber numberWithInt:number]];
label.position = CGPointMake(35, 20);
[self addChild:label];
}
Take a look at your code and understand how alloc/copy/retain need balanced with release/autorelease. At first glance, you are really messing up on the memory management.