Having trouble connecting a function to an animation player (Godot)

11 Views Asked by At

I have a Player node that has a child node AnimationPlayer that has an animation called water_right.

I also have another node called Crop that has a texture of a seedling. Inside of my Crop node I have a variable called is_watered: bool = false. Inside of my _ready() function inside the Crop node I have this:

func _ready():
    if is_watered:
        $Sprite2D.texture=ResourceLoader.load(image)

When I run the water_right animation (by pressing a button) I want to run a function called water() that simply changes the value of is_watered inside my Crop node to true that way the image changes. I'm using the call method to add a function and a key that activates right before the animation ends but I can't figure out exactly how to run the function inside the animation player.

0

There are 0 best solutions below