How to enable and disable an Area2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Socrates

I have a game with a simple enemy character that has an awake state and a dormant state. When it is dormant I don’t want it to detect or be detected by an area entering. I’ve tried setting the monitorable and monitoring properties to false when dormant and that works, but then when i set them back to true when it’s awake, my other Area2Ds still don’t detect them. Is there some other way to do this, or am I doing something wrong? I’ve tried printing out the monitoring and monitorable properties to see if they’re not being set to the values I want, but they are, so that doesn’t seem to be the problem.

Is the collision shape being disabled as well?

CollisionShape2D:
bool disabled
set_disabled(value) setter
is_disabled() getter

picnic | 2018-07-01 08:08

Ok, that works, thank you! I guess I misunderstood what monitoring and monitorable do. I still don’t understand why they don’t work :confused:

Socrates | 2018-07-01 15:39

1 Like
:bust_in_silhouette: Reply From: picnic

Is the collision shape being disabled as well?

CollisionShape2D:
bool disabled
set_disabled(value) setter
is_disabled() getter