0 votes

So, im making a game, where when you go near an object (a chest, for example), a textureFrame appears, showing what key you need to press to open that object (key E in my game)
So i made an Area2D node around the chest and i connected the signal bodyenter to the KinematicBody2D.
Inside the function _on
areabodyenter (body) i did getnode('TextureFrame').isvisible(true)
The texture frame is not a child of the kinematicbody and is not visible in the beginning
It doesnt work
I even tried : gettree().getroot().getnode('game').findnode('TextureFrame').is_visible(true)
Didnt work
How i can do that?

in Engine by (402 points)

i tried .sethidden and .setvisible
and it didnt work

You didn't mention adding a collision shape to the Area2D. If you just left that detail out, never mind, otherwise your Area2D needs a collision shape.

I didn't added a collision shape to the area2d. That's the problem?

Well, yeah... by adding a collision shape you let the engine know where is the area2D you want that area2D to be

Still doesn't work, even when Area2D has collision shapes. player has collision shapes too
And one problem, even when the player's collision shape collide with the area2d collision shape, nothing happens. The player just passes through

area2D doesnt function as a solid, you can pass through but if you connect the area2D's functions right you can see what is in the area

Solved that problem. But others come up.
Now, i connected signals and things... and i was able to set the 'buttons' to be hidden.
In the signal function, i called print to see if the area really responds to player's action
And it responded, printing what i said
The problem is, when i call set_hidden(false) in the signal function, the sprite is still invisible. I tried other metods such as changing the textures but that didn't work well.
How i can do that?

tried replacing the false with true?

True will still set it to be hidden bcs its set_hidden(bool)

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.