0 votes

am using GDScript and i have other object with function called Change_Location, and am trying to call this function from other script
the code:

$CameraBody/Camera/BuyHouses/StaticBody.Change_Location(mx, my)

the object CameraBody is not recognized but its exists in the world node
can someone help me?

the whole function:

func on_input_event(camera, event, click_position, click_normal, shape_idx):
    var mouse_click = event as InputEventMouseButton
    if mouse_click and mouse_click.button_index == 1 and mouse_click.pressed:
        var mouse_pos = get_viewport().get_mouse_position()
        var mx = mouse_pos.x
        var my = mouse_pos.y
        $CameraBody/Camera/BuyHouses/StaticBody.Change_Location(mx, my)
Godot version v3.2.3 stable-mon x64 windows
in Engine by (23 points)

1 Answer

0 votes
Best answer

i fixed it, i had to navigate to the location of the node

$"../../CameraBody/Camera/BuyHouses/MenuLoc".Change_Location(mx, my)
by (23 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.