Hello everyone,
I would like to understand what I did wrong in the code. I got this message:“Identifier “sprite” not declared in the current scope.” Should I enter a new variable?
Thanks in advance for the answers
Hello everyone,
I would like to understand what I did wrong in the code. I got this message:“Identifier “sprite” not declared in the current scope.” Should I enter a new variable?
Thanks in advance for the answers
Could you maybe show us a sreenshot of your code?
But just from this, it seems like you use the var ‘sprite’ without declaring it beforehand.
What you could do:
@onready var sprite : Sprite2D = get_node(“your_sprite”)
#remember to select the wanted sprite instead of #“your_sprite”
You could also use:
$Sprite2D instead of get_node(“your_sprite”)
Hope this helps
Edit: it might also be that you declared it already, just not in the correct function, this is just not possible to know without seeing the code
Hey, thank you for your reply!
I see the issue now. You use ‘sprite’ without having it declared before. This is because you declared ‘sprite_2D’
Either You use ‘sprite_2D’ or change the variable name to ‘sprite’.
Other than that, it looks pretty good
Your variable name is sprite_2D not sprite.
You save my day. Thank’s a lot
Great to hear that, have an awesome day!
you too