0 votes

the script is attached to the "ennmy_sprite" sprite.
here is the scene tree:
here is the scene tree

and here is the code:

extends Sprite

var player_sprite

func _ready():
    player_sprite = get_node("/root/player/player_sprite")
    set_process(true)

func _process(delta):
    if player_sprite:
        print("player_sprite")

i'm having : error Node not found

in Engine by (27 points)
reshown by

1 Answer

+1 vote
Best answer

You're forgetting the top node in your scene in your path to player_sprite:

get_node("/root/Level/player/player_sprite")

by (1,330 points)
selected by

thanks, I thought that the scene node is the root path.

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 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 webmaster@godotengine.org with your username.