Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

PizzaTray

macrumors newbie
Original poster
Oct 31, 2009
25
0
I'm trying to render to screen the score of the player in my game.
The problem is that after he kills first enemy, the score(Int) going crazy with numbers and after few seconds its crash the app.

The thing is, that i'm rendering to screen the time(float) that passed too, and it works great.

Define:
Code:
int [COLOR="Red"]scoreInt[/COLOR];
NSString *[COLOR="red"]scoreTxt[/COLOR];

float timerFloat;
NSString *timerTxt;
If detects collision:
Code:
if(enmy1.isAlive) {		
enmy1.isAlive = NO;

[COLOR="red"]scoreInt[/COLOR] += 10;
[COLOR="red"]scoreTxt[/COLOR] = [NSString stringWithFormat:@"%d", [COLOR="red"]scoreInt[/COLOR]];
Render it:
Code:
[fontScore drawStringAt:CGPointMake(20,0) [COLOR="red"][COLOR="Black"]text:[/COLOR]scoreTxt[/COLOR]];
[fontTimer drawStringAt:CGPointMake(380,0) text:timerTxt];

And the same thing here, BUT its NOT crashing my app!
Code:
timerFloat += delta;
timerTxt = [NSString stringWithFormat:@"%g", timerFloat];

Any ideas?

Edit: Someone from other forum solve that for me.
here, if someone wants.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.