     let swipeRightGesture = UISwipeGestureRecognizer(target: self, action: "handleSwipe:")
     swipeRightGesture.direction = UISwipeGestureRecognizerDirection.Right
     view.addGestureRecognizer(swipeRightGesture)
+  }
+  
+  
+  func setupCarSpawnNodes() {
+    // For each road, place car spawn node.
+    for row in 0..<levelData.data.rowCount() {
+      
+      let type = levelData.gameLevelDataTypeForGridPosition(column: 5, row: row)
+      
+      if type == GameLevelDataType.Road {
+        
+        // Determine if the car should start from the left of the right
+        let startCol = row % 2 == 0 ? 0 : levelData.data.columnCount() - 1
+        let moveDirection : Float = row % 2 == 0 ? 1.0 : -1.0
+        
+        // Determine the position of the node
+        var position = levelData.coordinatesForGridPosition(column: startCol, row: row)
+        position = SCNVector3(x: position.x, y: 0.15, z: position.z)
+        
+        // Create node
+        let spawnNode = SCNNode()
+        spawnNode.position = position
+        
+        // Create an action to make the node spawn cars
+        let spawnAction = SCNAction.runBlock({ node in
+          
+          // TODO: Change code to create a car
+          let car = SCNNode()
+          
+          // TODO: Add the code to make the car move
+          
+        })
+        // Will spawn a new car every 5 + (random time interval up to 5 seconds)
+        let delayAction = SCNAction.waitForDuration(5.0, withRange: 5.0)
+        
+        spawnNode.runAction(SCNAction.repeatActionForever(SCNAction.sequence([delayAction, spawnAction])))
+        
+        self.rootNode.addChildNode(spawnNode)
+      }
+      
+    }
   }
   
   

      switch swipeGesture.direction {
      case UISwipeGestureRecognizerDirection.Up:
        // TODO: Add code to do movement here
        break
        
      case UISwipeGestureRecognizerDirection.Down:
        // TODO: Add code to do movement here
        break
        
      case UISwipeGestureRecognizerDirection.Left:
        // TODO: Add code to do movement here
        break
        
      case UISwipeGestureRecognizerDirection.Right:
        // TODO: Add code to do movement here
        break
        
      default:

    }
  }
  
  // TODO: Uncomment code for player movement here
  func movePlayerInDirection(direction: MoveDirection) {
    
    switch gameState {
    case GameState.WaitingForFirstTap:
      
      // Start playing
      switchToPlaying()
      movePlayerInDirection(direction)
      break
      
    case GameState.Playing:
      
      // Determine if the new position is a valid position
      var newPlayerGridCol = playerGridCol
      var newPlayerGridRow = playerGridRow
      
      switch direction {
      case .Forward:
        newPlayerGridRow += 1
        break;
      case .Backward:
        newPlayerGridRow -= 1
        break
      case .Left:
        newPlayerGridCol -= 1
        break
      case .Right:
        newPlayerGridCol += 1
      }
      
      // Determine the type of tile at new position
      let type = levelData.gameLevelDataTypeForGridPosition(column: newPlayerGridCol, row: newPlayerGridRow)
      
      if type == GameLevelDataType.Invalid || type == GameLevelDataType.Obstacle {
        // Invalid - do not move
        // println("Invalid move")
        
      } else {
        // Valid - move
        // println("Valid move to \(newPlayerGridCol), \(newPlayerGridRow)")
        
        playerGridCol = newPlayerGridCol
        playerGridRow = newPlayerGridRow
        
        // Move the player to new position
        var newPlayerPosition = levelData.coordinatesForGridPosition(column: playerGridCol, row: playerGridRow)
        newPlayerPosition = SCNVector3(x: newPlayerPosition.x, y: 0.1, z: newPlayerPosition.z)
        
        // Move the player using an action
        let moveAction = SCNAction.moveTo(newPlayerPosition, duration: 0.2)
        let jumpUpAction = SCNAction.moveBy(SCNVector3(x: 0.0, y: 0.2, z: 0.0), duration: 0.1)
        jumpUpAction.timingMode = SCNActionTimingMode.EaseInEaseOut
        let jumpDownAction = SCNAction.moveBy(SCNVector3(x: 0.0, y: -0.2, z: 0.0), duration: 0.1)
        jumpDownAction.timingMode = SCNActionTimingMode.EaseInEaseOut
        let jumpAction = SCNAction.sequence([jumpUpAction, jumpDownAction])
        
        // Play the action
        player.runAction(moveAction)
        playerModelNode.runAction(jumpAction)
        
        // Play jump sound
        if let overlay = view.overlaySKScene {
          overlay.runAction(soundJump)
        }
      }
      
      break
      
    case GameState.GameOver:
      
      // Switch to tutorial
      switchToRestartLevel()
      break
      
    case GameState.RestartLevel:
      
      // Switch to new level
      // switchToWaitingForFirstTap()
      break
      
    default:
      break
    }
    
  }
  
}