Count down timer
Posted
by Ohmnastrum
on Stack Overflow
See other posts from Stack Overflow
or by Ohmnastrum
Published on 2010-05-24T21:27:07Z
Indexed on
2010/05/24
21:31 UTC
Read the original article
Hit count: 240
objective-c
I have a timer set up and it gets called when ever the player is in their turn phase. I also have a multiplier that decrements slowly while the player is committing actions.
for some odd reason my mult variable is returning garbage values I initialized it to 1 in the onLoad statement but it still seems to have trouble.
-(void) Timerbar:(NSTimer *)barTimer {
if(!waitForPlayer) {
[barTimer invalidate];
}
if(mult > 0.0) {
mult -= 0.01;
if(mult < 0) {
mult = 0;
}
}
power = (mult * 10) / pwrBarMaxWidth;
pwrBarWidth = (int)power % limit;
NSLog(@"%d", mult);
}
Do I have a syntax error somewhere?
© Stack Overflow or respective owner