0

I have implemented the following method in my Sprite Kit Game:

-(void) sprayWater{  
    [self runAction:[SKAction repeatActionForever:[SKAction animateWithTextures:self.runWasserFrames timePerFrame:0.05 resize:YES restore:YES]] withKey:@"water"];    
}

What ist the most elegant way to set the minimum time of this action to 1,5 seconds? I tried several ways, but they did not work out for me so far.

4

1 回答 1

0

如果我正确理解了这个问题,你应该尝试这样的事情:

-(void) sprayWater
{  

        if ([self actionForKey:@"water"] == nil)
        {
             [self runAction:[SKAction repeatActionForever:[SKAction animateWithTextures:self.runWasserFrames timePerFrame:0.05 resize:YES restore:YES]] withKey:@"water"];   
        } 
}

逻辑是如果水已经在流,不要创建另一个动作。

于 2014-06-15T19:23:11.240 回答