ios - SKAction: how to generate a random delay in generation of nodes -


I use the following part of the code to generate SKNodes from time to time to make these encodes random There is a way to make a duration. In particular, how do I create "delayFish" in the following code, which can be an action with a random delay?

ObjC:

ago Set the average delay and range ...

  #define kAverageDelay 2.0 #define kDelayRange 1.0 // plus or minus 0.5 seconds varies depending on   < P> And then change your delay on this action ...    SKAction * delayFish = [SKAction waitForDuration: kAverageDelay withRange: kDelayRange];   

Swift:

Set the average delay and range first ...

  Average Avg Give: Range with TimeInterval = 2.0 delay: Time difference = 1.0 // Plus or minus varies with 0.5 seconds   

And then change your delayFish action to ... < / P>

  delay file = SKAction.wait (forDuration: average middle, range: range)    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -