 //            let action = SKAction.moveTo(location, duration: 1)
 //            sprite1.runAction(SKAction.repeatAction(action, count: 1))
 
-            selected[touch as UITouch] = nodeAtPoint(location)
-
+            let node = nodeAtPoint(location)
+            selected[touch as UITouch] = node
+            offsets[touch as UITouch] = subtractVectorPoints(location, node.position)
 
         }
     }

    override func update(currentTime: CFTimeInterval) {
        /* Called before each frame is rendered */
        for (touch, node) in selected {
            let location = touch.locationInView(nil)
            let action = SKAction.moveTo(location, duration: 0.01)
            node.runAction(SKAction.repeatAction(action, count: 1))
        }
    }
}

    let sprite4 = SKSpriteNode(color: UIColor(red: 1.0, green: 1.0, blue: 0.0, alpha: 1.0), size: CGSize(width: 10, height: 10))

    var selected: [UITouch: SKNode] = [:]
    var offsets: [UITouch: CGPoint] = [:]

    func selectNodeForTouch(touchLocation: CGPoint) {
        // http://www.raywenderlich.com/44270/sprite-kit-tutorial-how-to-drag-and-drop-sprites
