Hey all so im trying to display a bitmapfontAtlas. It works perfectly to display it but when i try to update it, it crashes. here is what i have
-(void) displayScore {
BitmapFontAtlas *label1 = [BitmapFontAtlas bitmapFontAtlasWithString:@"SCORE:" fntFile:@"IceAge3.fnt"];
label1.anchorPoint = ccp(0,0);
[self addChild:label1 z:0 tag:kTagBitmapAtlas1];
CGSize s = [[Director sharedDirector] winSize];
label1.position = ccp( s.width/2, s.height/2);
}
This displays fine but then in my game loop i have updateScore and this:
-(void) updateScore {
int score = [GlobalDataManager sharedDataManager].currentScore;
NSString *string = [NSString stringWithFormat:@"SCORE: %i", score];
NSLog(@"%@", string);
BitmapFontAtlas *label1 = (BitmapFontAtlas*) [self getChildByTag:kTagBitmapAtlas1];
[label1 setString:string];
}
It crashes on:
[label1 setString:string];
with:
*** -[AtlasSpriteManager setString:]: unrecognized selector sent to instance 0xe6d540
2009-07-28 01:13:36.352 SnowFight[62234:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AtlasSpriteManager setString:]: unrecognized selector sent to instance 0xe6d540'
Im sure I made a stupid mistake somewhere but i copied and pasted this from the cocos2d project.
Thanks
-Lars