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:
If detects collision:
Render it:
And the same thing here, BUT its NOT crashing my app!
Any ideas?
Edit: Someone from other forum solve that for me.
here, if someone wants.
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;
Code:
if(enmy1.isAlive) {
enmy1.isAlive = NO;
[COLOR="red"]scoreInt[/COLOR] += 10;
[COLOR="red"]scoreTxt[/COLOR] = [NSString stringWithFormat:@"%d", [COLOR="red"]scoreInt[/COLOR]];
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.