-2
    _pipeTexture1 = [SKTexture textureWithImageNamed:@"p2"];                                     
    _pipeTexture1.filteringMode = SKTextureFilteringNearest;
    _pipeTexture2 = [SKTexture textureWithImageNamed:@"p1"];                                     
    _pipeTexture2.filteringMode = SKTextureFilteringNearest;

    CGFloat distanceToMove = self.frame.size.width + 2 * _pipeTexture1.size.width;                  
    SKAction* movePipes = [SKAction moveByX:-distanceToMove y:0 duration:0.01 * distanceToMove];    
    SKAction* removePipes = [SKAction removeFromParent];                                            
    _movePipesAndRemove = [SKAction sequence:@[movePipes, removePipes]];                            

    SKAction* spawn = [SKAction performSelector:@selector(spawnPipes) onTarget:self];               
    SKAction* delay = [SKAction waitForDuration:2.0];                                               
    SKAction* spawnThenDelay = [SKAction sequence:@[spawn, delay]];                                 
    SKAction* spawnThenDelayForever = [SKAction repeatActionForever:spawnThenDelay];                
    [self runAction:spawnThenDelayForever];  

我怎样才能停止某些特定场景的动画动作?

4

1 回答 1

0

根据SKNode 文档,您可以-(void)runAction:(SKAction *)action withKey:(NSString *)key在第一次运行操作时使用它来为操作分配名称。然后您可以稍后使用 删除它- (void)removeActionForKey:(NSString *)key

于 2014-04-21T14:14:49.257 回答