0 votes

Hello there! Can you help me, please?

I am trying to make possible for player to select an enemy in my 2D top-down game. Once the target is selected, the player should get its name. I've tried whats on the pictures below.

Everything is instanced in-game.

Used variables are:
- cursorarea = Area2D node with child node RectangleShape2D called cursorshape
- possibletargets = an empty array
- target
nameplate = Label node

In settarget() func, the rest of the line not shown on the picture is just the globalposition of the cursor_area.

Now the thing is, it seems I can't get the name of the target. print(targetname) is not printing anything and the targetnameplate is also showing nothing.

enter image description here
enter image description here

in Engine by (60 points)

Please log in or register to answer this question.

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.