I made a script that makes an array of an X and a Y value. It prints just fine in the script itself, but when I try to print it out on other scripts, its blank.
Global script:
var cords : Array = []
var current_y: int = -1
var x: int = 0
func _ready():
for child in get_children():
if child is Button:
child.mouse_entered.connect(_on_hovered.bind(child))
#get the Y cord
func _on_hovered(button: Button):
var y = int(button.name)
current_y = y
#get the X cord
func _process(_delta):
if current_y != -1 and Input.get_last_mouse_velocity() != Vector2(0,0):
var global_pos = get_viewport().get_mouse_position()
var local_pos = global_pos - global_position
x = round(local_pos.x / 85)
cords = [x, current_y]