When all of the strawberries have been collected the Checkpoint will emit a custom signal called trigger.
When all of the strawberries have been collected the Checkpoint will emit a custom signal called trigger.
Add 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)
When that signal is sent the checkpoint will play the trigger animation (extending the flag)
Connect the trigger signal and add the code.
Connect the trigger signal and add the code.
When the CheckPoint scene is loaded
When the CheckPoint scene is loaded
The idle animation should play
The idle animation should play
Add code to the _ready() function to do this.
Add code to the _ready() function to do this.
Add a variable to mark the level as complete or not
Add a variable to mark the level as complete or not
Connect the animation finished signal on the
Connect the animation finished signal on the
AnimatedSprite2D node.
AnimatedSprite2D node.
Once the trigger animation has finished playing.
Once the trigger animation has finished playing.
We prevent it from looping.
We prevent it from looping.
Then we play the flag fly animation
Then we play the flag fly animation
Then we mark the level as complete.
Then we mark the level as complete.
Connect the on_body_entered signal of the CheckPoint node.
Connect the on_body_entered signal of the CheckPoint node.
So that when the player touches the flag pole
So that when the player touches the flag pole
We can switch levels or quit the game etc.
We can switch levels or quit the game etc.