Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)addObjectMethod {
- UIImageView *bomb = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"Character.png" ]];
- [self.view addSubview: bomb];
- [bomb release];
- CGPoint position;
- //do the stuff above to create the position
- //pick a position anywhere on screen
- position.x = arc4random() % 360;
- position.y = 10;
- bomb.center = position;
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDelegate:self];
- [UIView setAnimationDuration:1.00];
- [UIView setAnimationBeginsFromCurrentState:YES];
- bomb.frame = CGRectMake(bomb.frame.origin.x, (bomb.frame.origin.y + 510.00), bomb.frame.size.width, bomb.frame.size.height);
- [UIView commitAnimations];
- }
- -(IBAction)start:(id)sender {
- [NSTimer scheduledTimerWithTimeInterval:(0.8/0.7) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- [NSTimer scheduledTimerWithTimeInterval:(1.0/3.0) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- [NSTimer scheduledTimerWithTimeInterval:(1.0/2.3) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- [NSTimer scheduledTimerWithTimeInterval:(1.0/2.1) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- [NSTimer scheduledTimerWithTimeInterval:(1.0/0.2) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- [NSTimer scheduledTimerWithTimeInterval:(1.0/1.3) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- [NSTimer scheduledTimerWithTimeInterval:(1.0/2.5) target:self selector:@selector(addObjectMethod) userInfo:nil repeats:NO];
- }
Add Comment
Please, Sign In to add comment