             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
+        }
+    }
     
 }

                    if p1.y > 240 {
                        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 if p1.y < 239 {  //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
                        }
                    }

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