Frage

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?

War es hilfreich?

Lösung

Use completion.

[self runAction:wait completion:^
{ [self startSpawning] }];
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top