+2 votes

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.

in Engine by (14 points)
recategorized by

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

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

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?

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

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.

1 Answer

0 votes

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

by (577 points)
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.