0

このようなものに相当する SpriteKit は何ですか?

[CCNode schedule:@selector(doActivate)
        interval:[[enemyData objectForKey:@"spawnTime"] floatValue]];
4

2 に答える 2

3

これを行うには、SKAction を使用できます。

+ (SKAction *)performSelector:(SEL)selector onTarget:(id)target or 

+ (SKAction *)runBlock:(dispatch_block_t)block queue:(dispatch_queue_t)queue

と組み合わせ:

+ (SKAction *)repeatActionForever:(SKAction *)action

+ (SKAction *)waitForDuration:(NSTimeInterval)sec

各呼び出し間の遅延

于 2013-10-31T18:53:47.987 に答える
0

Cocos のスケジューラー:

[self schedule:@selector(doActivate:)
      interval:[[enemyData objectForKey:@"spawnTime"] floatValue]];

SKAction を使用した Spritekit と同等:

SKAction *wait = [SKAction waitForDuration:[[enemyData objectForKey:@"spawnTime"] floatValue]];
SKAction *performSelector = [SKAction performSelector:@selector(doActivate:) onTarget:self];
SKAction *sequence = [SKAction sequence:@[performSelector, wait]];
SKAction *repeat   = [SKAction repeatActionForever:sequence];
[self runAction:repeat];
于 2014-03-28T12:54:11.007 に答える