Area2D not responding when colliding with KinematicBody2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GunPoint
:warning: Old Version Published before Godot 3 was released.

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 body_enter to the KinematicBody2D.
Inside the function _on_area_body_enter (body) i did get_node(‘TextureFrame’).is_visible(true)
The texture frame is not a child of the kinematicbody and is not visible in the beginning
It doesnt work
I even tried : get_tree().get_root().get_node(‘game’).find_node(‘TextureFrame’).is_visible(true)
Didnt work
How i can do that?

i tried .set_hidden and .set_visible
and it didnt work

GunPoint | 2017-10-13 12:16

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.

aozasori | 2017-10-14 01:31

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

GunPoint | 2017-10-14 08:11

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

rustyStriker | 2017-10-14 08:43

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

GunPoint | 2017-10-14 12:55

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

rustyStriker | 2017-10-14 13:07

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?

GunPoint | 2017-10-14 13:40

tried replacing the false with true?

rustyStriker | 2017-10-14 13:42

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

GunPoint | 2017-10-14 19:00