ios7 - Reposition sprite nodes after SKAction is completed -


i trying reposition sprites after skaction moveto action completed. have programmed enemies enter screen (self.frame.size.width/2, 0). moving on y axis. want reposition them on initial position when y position bigger (self.frame.size.height) , move them again , again in same way until player kills of enemies. struggling on point.what part of code should add? ideas? code might understand implementation :

-(void) addenemies {  (int j = 0; j < 6; j++) {     skspritenode* enemy = [skspritenode spritenodewithimagenamed:@"player"];     enemy.position = cgpointmake(((self.frame.size.width) -20) - j * (enemy.frame.size.width) , 0);       cgpoint realdest = cgpointmake((enemy.position.x), (self.frame.size.height));     float velocity = 50/1.0;     float realmoveduration = self.size.height / velocity;     skaction * actionmove = [skaction moveto:realdest duration:realmoveduration];     [enemy runaction:actionmove];      [self addchild:enemy]; }  } 

-(void)addenemies{     (int j = 0; j < 6; j++) {          skspritenode* enemy = [skspritenode spritenodewithimagenamed:@"player"];         enemy.position = cgpointmake(((self.frame.size.width) -20) - j * (enemy.frame.size.width) , 0);          [self addchild:enemy];         [self moveenemynode:enemy];     } } -(void)moveenemynode:(skspritenode *)enemy{     enemy.position = cgpointmake(enemy.position.x, 0);     float velocity = 50/1.0;     float realmoveduration = self.size.height / velocity;     skaction *actionmove = [skaction movetoy:self.frame.size.height + enemy.frame.size.height duration:realmoveduration];     [self runaction:actionmove completion:^{         [self moveenemynode:enemy];     }]; } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -