I don't think you'd need a game loop for that because you're reacting to a touch/timer event. Make a function which switches to the next card, then call it from your touches ended or a timer function, depending on which one fires first. You would have to remember to reset the timer if you get a touch event, otherwise it will fire twice when you touch.
-(void) changeCard {
//Assumes your sprites are called "card01.png", with the number incrementing
static int currentCard=0;
int maxCards=99; //Set to your highest card+1
currentCard++;
if(currentCard<maxCards) {
NSString *spriteLoad=[[NSString alloc] initWithFormat:@"card%02d.png",currentCard];
CCSprite *oldCard=(CCSprite *)[self getChildByTag:100];
if(oldCard) [self removeChild:oldCard withCleanup:YES];
CCSprite *card=[CCSprite spriteWithFile:spriteLoad];
[card setPosition:ccp(160,240)];
[self addChild:card z:0 tag:100];
[spriteLoad release];
} else {
//reached the end of the cards
}
}
...in your init function,
[self schedule:@selector(step:) interval:2];
...then from CCTouchesEnded,
- (void)ccTouchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
[self changeCard];
[self unschedule:@selector(step:)];
[self schedule:@selector(step:) interval:2];
}
...and from step:
-(void) step:(ccTime) delta {
[self changeCard];
}
Sorry, typing this from a PC, so I can't check if it's right, but should give you an idea.
Cheers,
Andrew.