title: Spawning an Enemy
body: <p>In my game I want an enemy to spawn every 10 seconds. I attempt to accomplish this by, in the GameViewController, writing</p>
  
  <pre><code>var secondEnemyTimer = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: "secondEnemyFunction", userInfo: nil, repeats: false)
  </code></pre>
  
  <p>in the viewWillLayoutSubviews method. Then in the secondEnemyFunction I write:</p>
  
  <pre><code>let skView = self.view as! SKView
      let gameScene = GameScene(size: skView.bounds.size)
  
      gameScene.enemy2Function()
  </code></pre>
  
  <p>Then in the enemy2Function in the GameScene class I write:</p>
  
  <pre><code> println("Called!")
  
      enemy2.name = enemyCategoryName
  
      enemy2.size.width = 57
      enemy2.size.height = 57
  
      let randomX = randomInRange(Int(CGRectGetMinX(self.frame)), hi: Int(CGRectGetMaxX(self.frame)))
      let randomY = randomInRange(Int(CGRectGetMinY(self.frame)), hi: Int(CGRectGetMaxY(self.frame)))
      let randomPoint = CGPoint(x: randomX, y: randomY)
      enemy2.position = randomPoint
  
      self.addChild(enemy2)
  
      enemy2.physicsBody = SKPhysicsBody(circleOfRadius: enemy1.size.width / 2)
      enemy2.physicsBody?.friction = 0
      enemy2.physicsBody?.restitution = 1
      enemy2.physicsBody?.linearDamping = 0
      enemy2.physicsBody?.allowsRotation = false
  
      enemy2.physicsBody?.applyImpulse(CGVectorMake(50, -50))
  
      enemy2.physicsBody?.categoryBitMask = enemyCategory
  </code></pre>
  
  <p>In the log "Called!" appear yet the enemy is not spawned. Just so you know I did create the enemy at the top of the class by doing:</p>
  
  <pre><code>let enemy2 = SKSpriteNode(imageNamed: "enemy")
  </code></pre>
  
  <p>Does anyone know how I can spawn my second enemy? Thank you in advance!</p>
  
  <p>-Vinny</p>