My taking damage code isn't working, please help!

Hello, I’m making a game where the player takes damage when they touch an object, in this case a flower, but for some reason, it doesn’t work, the player just walks past it like it’s nothing.

here is the script of the player

And here is the script of the flower

I don’t understand what is wrong, please help!!

Did you set the collisionmask of the Flower to 2? Your player is on layer 2 so for the flower to detect the player it needs the collisionmask to activate layer 2

1 Like

oh, it really worked!! thank you!! But, Just one more thing I have another obstacle, which looks the same as the other ones to me, but for some reason doesn’t work like the others. What could be the problem?


Looks like the signal isn’t connected in this scene, the script has a function for body entered but it still needs connecting through the node tab

1 Like

Thank you sooo much!!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.