I have a character of a pig as my player, and it is at the end of the level where it must eat a glowing truffles. I have scripted my object with an Area2D with this function
func onTrufflebodyentered(body):
queue_free()
However, the orbs disappear when I collide with them, but I have also scripted the pig with the action of eating. I would like my pig to eat the truffles when the spacebar is pressed.
How can I make my pig seem like it is eating the truffles on command, and when the spacebar is pressed?