Guest User

Untitled

a guest
Aug 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. CCSprite runAction and Remove
  2. [self schedule:@selector(throwRain) interval:0.1f];
  3.  
  4. -(void) throwRain {
  5. CCSprite *gota;
  6. for (int i = 1; i <= 6; i++){
  7. gota = [CCSprite spriteWithFile:@"4_gota.png"];
  8. gota.position = ccp(arc4random() % 768, 1060);
  9. gota.scale = (arc4random () % 25 + 50.0f) / 100.0f;
  10. gota.rotation = 35 ;
  11. [self addChild:gota z:arc4random() % 5 + 7];
  12.  
  13. [gota runAction:[CCSequence actions:[CCEaseRateAction actionWithAction:[CCMoveTo actionWithDuration:3.0f + (arc4random() % 200) / 100.0f position:ccp(gota.position.x, 0)] rate:3] , [CCCallFunc actionWithTarget:self selector:@selector(spriteDone:)], nil]];
  14. }
  15. }
  16.  
  17. -(void) spriteDone:(id)sender {
  18. [self removeChild:sender cleanup:YES];
  19. }
Add Comment
Please, Sign In to add comment