문제

I have a sprite kit scene in which enemies are dispatched at random intervals and a player has to destroy them. However I want to wait a 3 seconds before they start spawning. I tried

    -(id)initWithSize:(CGSize)size {    
if (self = [super initWithSize:size]) {
    /* Setup your scene here */

    //Set the init variables.
    //AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);

    SKAction *wait = [SKAction waitForDuration:3];
    [self runAction:wait];}

This doesn't work, what am I doing wrong?

도움이 되었습니까?

해결책

Use completion.

[self runAction:wait completion:^
{ [self startSpawning] }];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top