                     if p1.y <= 239 {
                         let p2 = CGPoint(x: p1.x, y: p1.y - 31)
                         if nodes(at: p2).count == 0 {
-                            node.removeFromParent()
                             node.position = p2
-                            addChild(node)
                             self.isLocationUpdated = true
                         }
                     }else{
                         let p2 = CGPoint(x: p1.x, y: p1.y + 31)
                         if nodes(at: p2).count == 0 {
-                            node.removeFromParent()
                             node.position = p2
-                            addChild(node)
                             self.isLocationUpdated = true
                         }
                     }

    func updateLocation() {
        self.isLocationUpdated = false  //进入本方法后，默认没有位置刷新，如果有，设为true继续循环
        switch level {
        case 0: //第一关，静态
            self.isLocationUpdated = false
            break
        case 1:  //垂直下落
            for i in self.nodesofGame {
                let node = i as! SKSpriteNode
                let p1 = node.position
                if p1.y > 115 {
                    let p2 = CGPoint(x: p1.x, y: p1.y - 31)
                    if nodes(at: p2).count == 0 {
                        node.removeFromParent()
                        node.position = p2
                        addChild(node)
                        self.isLocationUpdated = true
                    }
                }

            break
        }
    }
    func reloadlocation() {
        let oldpositionArr: NSMutableArray = []
        let newpositionArr: NSMutableArray = []
        for i in 0...nodesofGame.count-1 {
            let node = nodesofGame[i]
            let node1 = node as! SKSpriteNode
            let p1 = node1.position
            let p: NSValue = NSValue.init(cgPoint: p1)
            oldpositionArr.add(p)
        }  //将所有的位置点记录下来，用于置换位置
        print(oldpositionArr)
        for _ in 0...oldpositionArr.count-1 {
            let a = oldpositionArr.count
            let b = arc4random()%(UInt32(a))
            let p = oldpositionArr[Int(b)]
            oldpositionArr.remove(p)
            newpositionArr.add(p) //将位置点打乱顺序后重新排列
        }
        for i in 0...nodesofGame.count-1 { //重新排列位置
            let p = nodesofGame[i]
            let p1 = p as! SKSpriteNode
            let a = newpositionArr[i] as! NSValue
            let a1 = a.cgPointValue
            p1.position = a1
        }
    }
    
}
