When all of the strawberries have been collected the Checkpoint will emit a custom signal called trigger.

Add a custom signal called trigger.

When that signal is sent the checkpoint will play the trigger animation (extending the flag)

Connect the trigger signal and add the code.

When the CheckPoint scene is loaded

The idle animation should play

Add code to the _ready() function to do this.

Add a variable to mark the level as complete or not

Connect the animation finished signal on the

AnimatedSprite2D node.

Once the trigger animation has finished playing.

We prevent it from looping.

Then we play the flag fly animation

Then we mark the level as complete.

Connect the on_body_entered signal of the CheckPoint node.

So that when the player touches the flag pole

We can switch levels or quit the game etc.