Help with an AI disappearing when clicked

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

I am relatively new to Godot and I was working on my game when I ran into a problem. My game is 2D and there are foxes trying to attack a chicken. I wanted for when the fox is clicked to disappear. Anyone know how to do this.

do you want them to die, (get removed from the game) or do you want them to still be there but not be shown?

Millard | 2020-11-30 17:24

I would like them to be removed from the game when clicked

Lightworm | 2020-11-30 17:42

so, what part are you having problems with, are you not sure how to detect when the player clicks on them, or how to remove them from the game, or both?

Millard | 2020-11-30 20:39

Basically, the click isnt being detected because a canvas layer is infront of it. Is there any way of stopping this and the fix getting the click. But yeah both

Lightworm | 2020-11-30 21:02

I haven’t used canvas layers yet, so I probably can’t help you there. but to remove the fox, you just have to call the foxes queue_free() function, which will remove it from the game.

Millard | 2020-11-30 21:52

:bust_in_silhouette: Reply From: scrubswithnosleeves

The canvas layer shouldn’t block the click by itself. Do you have control (green) nodes in the canvas layer? If so, go to their property Mouse and set it to either ignore or pass