Search Results

Search found 4 results on 1 pages for 'ohmnastrum'.

Page 1/1 | 1 

  • Count down timer

    - by Ohmnastrum
    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?

    Read the article

  • Playing animations in sequence in objecive c

    - by Ohmnastrum
    I'm trying to play animations in sequence but i'm having issues playing them as a for loop iterates through the list of objects in an array. it will move through the array but it won't play each one it just plays the last... -(void) startGame { gramma.animationDuration = 0.5; // Repeat forever gramma.animationRepeatCount = 1; int r = arc4random() % 4; [colorChoices addObject:[NSNumber numberWithInt:r]]; int anInt = [[colorChoices objectAtIndex:0] integerValue]; NSLog(@"%d", anInt); for (int i = 0; i < colorChoices.count; i++) { [self StrikeFrog:[[colorChoices objectAtIndex:i] integerValue]]; //NSLog(@"%d", [[colorChoices objectAtIndex:i] integerValue]); sleep(1); } } it moves through the whole cycle really fast and sleep isn't doing anything to allow it to play each animation... any suggestions?

    Read the article

  • Making a visual bar timer for iPhone

    - by Ohmnastrum
    I've looked up all results for progress bars and changing the width of an image but it only refers to scaling, and the progress bars aren't customizable so that they fit other functions or design schemes... unless I missed that part. I'm trying to make a bar timer that crops off of the right over a period of time. I tried using an NStimer so that it would subtract from a value each time its function is called. the Timerbar function gets called as a result of another timer invalidating and it works. What doesn't work is that the width isn't changing just the position. further more I keep getting values like Inf and 0 for power and pwrBarWidth I was sure that the changes would occur when Mult was plugged into the equation. it seems like casting mult as an int is causing problems but i'm not sure exactly how. int pwrBarMaxWidth = 137; int pwrBarWidth 0; int limit = 1; float mult; float power = 0; -(void) Timerbar:(NSTimer *)barTimer { if(!waitForPlayer) { [barTimer invalidate]; } if(mult > 0.0) { mult -= 0.001 * [colorChoices count]; if(mult < 0.0) { mult = 0.0; } } power = (mult * 10) / pwrBarMaxWidth; pwrBarWidth = (int)power % limit; // causes the bar to repeat after it reaches a certain point //At this point however the variable Power is always "inf" and PwrBarWidth is always 0. [powerBar setBounds:CGRectMake(powerBar.frame.origin.x, powerBar.frame.origin.y,pwrBarWidth,20)]; //supposed to change the crop of the bar } Any reason why I'm getting inf as a value for power, 0 as a value for pwrBarWidth, and the bar itself isn't cropping? if this question is a bit vague i'll provide more information as needed.

    Read the article

  • Adding an integer onto an array

    - by Ohmnastrum
    I'm trying to add random numbers onto the end of this array when ever I call this function. I've narrowed it down to just this so far. when ever I check to see if anything is in the array it says 0. So now i'm quite stumped. I'm thinking that MutableArray releases the contents of it before I ever get to use them. problem is I don't know what to use. A button calls the function and pretty much everything else is taken care of its just this portion inside the function. NSMutableArray * choices; -(void) doSomething { int r = arc4random() % 4; //The problem... [choices addObject:[NSNumber numberWithInt:r]]; int anInt = [[choices objectAtIndex:1] integerValue]; NSLog(@"%d", anInt); //I'm getting nothing no matter what I do. //some type of loop that goes through the array and displays each element //after it gets added }

    Read the article

1