Hi, it's my first time asking question at here, forgive me if I done anything wrong XD.
I've added a child(tooltip) to my scene and change its position everytime my mouse move within the TextureButton.
func _process(delta):
if follow:
if previous_mouse == null:
previous_mouse = get_global_mouse_position()
else:
if previous_mouse != get_global_mouse_position():
get_tree().get_root().get_node("Tooltip").set_position(get_global_mouse_position())
func _on_TextureButton_mouse_entered():
var tooltip_instance = tooltip.instance()
get_tree().get_root().add_child(tooltip_instance)
follow = true
func _on_TextureButton_mouse_exited():
get_tree().get_root().get_node("Tooltip").queue_free()
previous_mouse = null
follow = false
It works if I move my mouse up and left, but when moving down and right, the placement of the tooltip seem out of place. Could anyone helps me figure it out what is happening?
The problem:
https://imgur.com/otYl4ED
Thanks in advance!