I need help with my food

I don’t know how to make my character get healed 10 dmg when he punches berries.
Here’s a link:
Flowlab Game Creator - Ultimate adventure

1 Like

Uhh since your code looks like you are pretty good already, I’ll just explain it.

Use a raycaster (or a couple, for more miss zone) that aims where he punches. Then make it so that when he punches, it will cast there. If it detects a berry, they gain ten health and send a message to the berry. The berry, on message, can destroy itself.

Also if you decide to use multiple different angled raycasts, make sure to use an OR gate connecting with all of your raycasts.

Tell me if you need pictures!

1 Like

Oooh! It worked. Thanks @Flying_Fajita

Wait, when I destroy one berry now it destroys all of them.

that’s probably because it is sending a message to all of the berries. Try using the “stop at first object” in the raycast behaviour and the “Message to last raycasted object” in the message behaviour.

1 Like

Thank you! It worked!