I am creating a game which have similar concept like Tap Tap Ant. I am generating dynamic images using NSTimer using following code.
NSTimer *tmrGenerateImages1 = [NSTimer scheduledTimerWithTimeInterval:0.4 target:self selector:@selector(generateImages) userInfo:nil repeats:YES];
-(void)generateImages
{
UIImageView *tmpImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImg.png"]];
[tmpImg setFrame:CGRectMake([self randomXValueBetween:30 andValue:280] , 50, 118, 97)];
[self.view addSubview:tmpImg];
[self.view bringSubviewToFront:tmpImg];
}
- (float)randomXValueBetween:(float)low andValue:(float)high {
return (((float) arc4random() / 0xFFFFFFFFu) * (high - low)) + low;
}
My question is in tap tap ant they are generating 2/3 images at a time and in my case I am able to generate only single image at a time and there is plenty of time user has to tap on it.
Please help me.
EDIT:
BOUNTY
I want to generate dynamic images using NSTimer or any other way as same as the Tap Tap Ant. Please help me in that regards. If solution is offered all the points are yours.
If you wan’t your game to be both fast responding and stable, I would really recommend looking into OpenGL or Cocos2d.
Allocating a UIImageView for every and and having them move bit by bit (you can not interrupt animations with taps) will really make the game… well… slow.