Ios removeAllActions精灵套件移动背景

Ios removeAllActions精灵套件移动背景,ios,iphone,objective-c,sprite-kit,Ios,Iphone,Objective C,Sprite Kit,我创建了这个SKSpriteNode,它是背景中移动的背景。我想要的是能够阻止我所做的所有行为 [self removeAllAction] 哪种方法有效,但不适用于移动背景为什么?我怎样才能得到这个 SKTexture* groundTexture = [SKTexture textureWithImageNamed:@"layer-1"]; groundTexture.filteringMode = SKTextureFilteringNearest; SKAc

我创建了这个SKSpriteNode,它是背景中移动的背景。我想要的是能够阻止我所做的所有行为

[self removeAllAction]
哪种方法有效,但不适用于移动背景为什么?我怎样才能得到这个

    SKTexture* groundTexture = [SKTexture textureWithImageNamed:@"layer-1"];
    groundTexture.filteringMode = SKTextureFilteringNearest;


    SKAction* moveGroundSprite = [SKAction moveByX:-groundTexture.size.width*2 y:0 duration:0.02 * groundTexture.size.width*2];
    SKAction* resetGroundSprite = [SKAction moveByX:groundTexture.size.width*2 y:0 duration:0];
    moveGroundSpritesForever = [SKAction repeatActionForever:[SKAction sequence:@[moveGroundSprite, resetGroundSprite]]];

    for( int i = 0; i < 2 + self.frame.size.width; ++i ) {
        // Create the sprite
        sprite = [SKSpriteNode spriteNodeWithTexture:groundTexture];
        [sprite setScale:1.0];
        sprite.position = CGPointMake(i * sprite.size.width, sprite.size.height / 2);
        [sprite runAction:moveGroundSpritesForever withKey:@"bg"];
        [self addChild:sprite];
    }
SKTexture*groundTexture=[SKTexture TextureWithimageName:@“layer-1”];
groundTexture.filteringMode=SKTextureFilteringNearest;
SKAction*moveGroundSprite=[SKAction-moveByX:-groundTexture.size.width*2y:0持续时间:0.02*groundTexture.size.width*2];
SKAction*resetGroundSprite=[SKAction moveByX:groundTexture.size.width*2y:0持续时间:0];
MoveGroundSpriteForever=[SKAction repeatActionForever:[SKAction sequence:@[moveGroundSprite,resetGroundSprite]];
对于(int i=0;i<2+self.frame.size.width;+i){
//创建精灵
sprite=[SKSpriteNode SpritotenodeWithTexture:groundTexture];
[雪碧设置比例:1.0];
sprite.position=CGPointMake(i*sprite.size.width,sprite.size.height/2);
[精灵运行动作:使用键永远移动地面精灵:@“bg”];
[self addChild:sprite];
}

您应该在
sprite
上调用[removeAllAction],而不是在
self
上调用[removeAllActions],我已经尝试了[self removeAllActions]和[sprite removeAllActions]Paulw11是正确的。命令[sprite removeAllActions]应该停止任何和所有附加到sprite的操作。您是否可能在代码中不知道的某个点重新启动该操作?您也可以尝试使用removeAction:withKey:删除该操作。这似乎适用于重复操作。