diff --git a/PlayerScript.gd b/PlayerScript.gd index 69e8c5e..b63ef4a 100644 --- a/PlayerScript.gd +++ b/PlayerScript.gd @@ -69,6 +69,7 @@ var InvertionArray = [] var CordsDump = [] var FullCount = 0 var Done = 0 +var Root = [] func _input(event): if Current_Position != TargetCord: @@ -181,8 +182,9 @@ func Circling(): if Intersections.find(Current_Position) != Intersections.size()-1 and Intersections.find(Current_Position) != -1 and Been_There_Array[-2] == false and Been_There_Array[-3] == false: print("Circling") Cicling = true - #ndividual_Steps.push_front(holder) - #CircleRootsAndInts() + Root = Current_Position + print("The Root is equal to: ",Root, " and its position in int array is: ", Intersections.find(Root)) + print("There are ", Intersections.size() - Intersections.find(Root), " Intersections") HowManyIntsInCircle() if CircleInts == 0: print("This Circle is exhausted go back") @@ -207,13 +209,31 @@ func HowManyIntsInCircle(): print(CircleInts) func FirstCirclePart(): + var Skipping_array = [] + print(Tree_Array) + for nums in Intersections.size() - Intersections.find(Root): + if nums > 0: + Skipping_array.push_back((Intersections.find(Root) - nums) + 1) + print(Skipping_array) + for x in Skipping_array: + print(x) + if Tree_Array[x] == 1: + print("Skip") + GoToParts() + + else: + print("Go To") + + +func GoToParts(): var holder = [] - for n in (move - BackTrack_Array[-1] + 1): + for n in (CircleManualDistance()): #holder.push_back(LogDump[n]) holder.push_front(Prev_dir_Opp) print(holder) - GoBack(holder) - + print(LogDump) + #GoBack(holder) + func CircleRootsAndInts(): if Cicling == true: if Detail_Dict.Type != "Plain Path": @@ -248,6 +268,15 @@ func CircleManualDistance(): var y = abs(Starting_Pos[1] - Ending_Pos[1]) return x+y +func ManualDistance(Start, End): + if DeadEndCircles() == true and Intersections_from_root.size() >= 2: + var Starting_Pos = Start + var Ending_Pos = End + + var x = abs(Starting_Pos[0] - Ending_Pos[0]) + var y = abs(Starting_Pos[1] - Ending_Pos[1]) + return x+y + func Intersection_Tree(): if Cicling == false: @@ -305,7 +334,7 @@ func TrackIntersections(): func MoveAfterIntersection(): if move == IntersectionMove+1: - if Move_Check6 != move: + if Move_Check6 != move and Cicling == false: if TrackBack.size() != 1 and BackTrack_Array.size() > 1: IntersectionDir.push_back(LogDumpOrdered[0]) if BackTrack_Array.size() > 1 and BackTrack_Array[-1] - BackTrack_Array[-2] == 1: