75 lines
1.2 KiB
GDScript
75 lines
1.2 KiB
GDScript
extends Node
|
|
|
|
|
|
class_name Data
|
|
|
|
#***** Gain Access to the Different Classes *****
|
|
|
|
var Right : bool
|
|
var Left : bool
|
|
var Up : bool
|
|
var Down : bool
|
|
|
|
var Current_Position : Array
|
|
|
|
# *****Data vars ******
|
|
|
|
#Arrays
|
|
|
|
var ways = ["None", "Dead End", "Plain Path", "3 Way Intersection", "4 Way Intersection"]
|
|
var Cords = [[0,0]]
|
|
|
|
#Dictionaries
|
|
|
|
var Coordinate_Dict = {"Position": [0,0]}
|
|
var Detail_Dict = { "Type": "",
|
|
"Came_From": "",
|
|
"Been_There": false}
|
|
|
|
#Single Vars
|
|
|
|
var Traveled = false
|
|
var State = 0
|
|
|
|
|
|
|
|
#***** Functions *****
|
|
|
|
func _process(delta):
|
|
Mark()
|
|
IntersectionCounter()
|
|
Been_There()
|
|
|
|
|
|
func IntersectionCounter():
|
|
|
|
var WaysToGo = 0
|
|
var Directions = [Right,Left,Down,Up]
|
|
for Direction in Directions:
|
|
if Direction == false:
|
|
WaysToGo += 1
|
|
if Direction == true:
|
|
pass
|
|
return WaysToGo
|
|
|
|
|
|
func Mark():
|
|
var response = ways[IntersectionCounter()]
|
|
Detail_Dict.Type = response
|
|
Detail_Dict.Came_From = "Hi"#Prev_dir
|
|
Detail_Dict.Been_There = Traveled
|
|
print(Current_Position)
|
|
|
|
|
|
func Been_There():
|
|
|
|
if Cords.find(Current_Position) == -1:
|
|
Cords.push_back(Current_Position)
|
|
var Cords_Copy = Cords.duplicate(true)
|
|
Cords = Cords_Copy
|
|
Traveled = false
|
|
else:
|
|
Traveled = true
|
|
|
|
|