title: Moving multiple sprite nodes at once on swift
body: <p>Can I make an  array of SK nodes of which one is selected randomly and brought from the top to bottom of the screen. For example say I have 25 or so different platforms that will be falling out of the sky on a portrait iPhone. I need it to randomly select one of the platforms from the array to start and then after a certain amount of time/ or pixel space randomly select another to continue the same action until reaching the bottom etc. Im new to swift but have a pretty decent understanding of it. I haven't been able to find out how to create an array of SKsprite nodes yet either. Could someone help with this? </p>
  
  <p>So far the only way I've been able to get any sort of effect similar to what I've wanted is by placing each of the nodes off the screen and adding them to a dictionary and making them move like this</p>
  
  <p>class ObstacleStatus {</p>
  
  <pre><code>    var isMoving = false
      var timeGapForNextRun = Int(0)
      var currentInterval = Int(0)
      init(isMoving: Bool, timeGapForNextRun: Int, currentInterval: Int) {
          self.isMoving = isMoving
          self.timeGapForNextRun = timeGapForNextRun
          self.currentInterval = currentInterval
  }
  
  func shouldRunBlock() -&gt; Bool {
      return self.currentInterval &gt;  self.timeGapForNextRun
  
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>func moveBlocks(){
      for(blocks, ObstacleStatus) in self.blockStatuses {
          var thisBlock = self.childNodeWithName(blocks)
          var thisBlock2 = self.childNodeWithName(blocks)
          if ObstacleStatus.shouldRunBlock() {
              ObstacleStatus.timeGapForNextRun = randomNum()
              ObstacleStatus.currentInterval = 0
              ObstacleStatus.isMoving = true
          }
  
          if ObstacleStatus.isMoving {
              if thisBlock?.position.y &gt; blockMaxY{
                      thisBlock?.position.y -= CGFloat(self.fallSpeed)
              }else{
                  thisBlock?.position.y = self.origBlockPosistionY
                  ObstacleStatus.isMoving = false
              }
          }else{
                  ObstacleStatus.currentInterval++
              }
  
      }
  }
  </code></pre>
  
  <p>using this for the random function</p>
  
  <pre><code>func randomNum() -&gt; Int{
   return randomInt(50, max: 300)        
  }
  
  func randomInt(min: Int, max:Int) -&gt; Int {
      return min + Int(arc4random_uniform(UInt32(max - min + 1)))
  }
  </code></pre>
  
  <p>All this has been doing for me is moving the pieces down at random timed intervals often overlapping them, But increasing the min or max of the random numbers doesn't really have an affect on the actual timing of the gaps. I need to be able to specify a distance or time gap. </p>