How to stop background music whenever the player died

How to stop background music whenever the player or character died

Depending on the way your character “die”, you may check:

  • If Player.Variable(HP)<=0 then stop music trigger once
  • If Number of Objects Player<=0 then stop music trigger once
  • If Player Current animation is finished and Player Current animation = “Die” then stops music (If your character has a diying animation and it has a name)
  • If Player Current animation is finished and Player Current animation number = X then stops music (If your character has a diying animation and it has a number, where X is the number).

I don’t know how you have done the condition for death, but these are a few I can think right now.

1 Like

Thanks replying my post

What I want for character is whenever my character died the background music stop and and when my character respawn the whole background music will play again along with the character

Just like the geometry dash game

I’m just new in GDevelop if you have some idea please help me

The way my character died is through a collision hit with other object I already have a dead and respawn the only problem is the music

Here, in the events when the player dies, I just add a line stoping the sound in channel one (The background music), before changing the scene. This way the music stops

I hope it helps

So your channel 1 music is at the beginning of the scene

And your at the beginning of the scene is under your game loop scene variable?

I will need to see your events to check how you could stop the game music.It is kinda hard to know the way you detect the player’s death.

In the Geometry Dash example, the music starts with the game scene, with a loop option. I just added the event to stop the music when the player is dead, and before the scene changes. When you resume the game, the music starts to play again.