Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bobokox | |
Old Version | Published before Godot 3 was released. |
Hey.
I have another problem with one of my scripts. I get the error “Invalid call. Nonexistent function set_global_pos
in base ‘bool’.”
The node char_menu
is a subscene with a node2d as root.
If menu_act
gets true, there is no problem. It moves the subscene to 0, 0. But if it gets false i get the error in the line of the first if statement.
the editor also gives me set_global_pos
as suggestion with the variable. so i don’t know what is wrong there. also tried it with set_hidden()
, same result
Do I overlook something?
extends Node2D
onready var n_menu = get_node("char_menu")
var menu_act = false
func _ready():
set_fixed_process(true)
func _fixed_process(delta):
if menu_act:
n_menu.set_global_pos(Vector2(0,0)) #### ERROR
get_tree().set_pause(true)
else:
n_menu.set_global_pos(Vector2(0,-2000))
Thank you!