0

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?

temp
  • 639
  • 1
  • 8
  • 22

1 Answers1

3

Use completion.

[self runAction:wait completion:^
{ [self startSpawning] }];
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172