Playing animations in sequence in objecive c

Posted by Ohmnastrum on Stack Overflow See other posts from Stack Overflow or by Ohmnastrum
Published on 2010-05-21T23:00:54Z Indexed on 2010/05/22 0:10 UTC
Read the original article Hit count: 226

Filed under:

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?

© Stack Overflow or respective owner

Related posts about iphone