[Solved] Sound plays only once and never again / doesn't play properly

I’ve been trying to get my “pickup” sound to play every time the player is in collision with certain items. Problem is, it only plays the sound once or twice when I pick up the item (plays twice if I pickup the second item fast enough, within a second) and never again. Here’s my code:

As an example, here’s a screenshot of my basic game: (imgur link as I can’t upload more than 1 img)

If character navigates to location #1 with 3 of the items, the sound will play once or twice depending how fast player collided with those objects. When player goes to pickup axe in #2 location, no sound is played. Vice versa, if player starts a game and goes to location #2, the sound plays properly. However, when we go back to location #1 no pickup sounds are played for none of the items. Not sure why this doesn’t work properly.

Note: I have tried this with trigger once enabled and disabled. Made no difference.

Any help would be greatly appreciated. I like the engine.

Game Link: https://games.gdevelop-app.com/game-7fc1c1e2-8286-4b6e-8b6a-d0ff28cc2346/index.html

In this test, both the music and the sounds are playing on different channels (1 and 2) and they can be hear just well.

When I used a code like the one you are showing, it got the same problems. Sometimes the sound plays, sometimes it doesn’t.

Try using different channels for the sound and music and see how it comes.

Just in case it doesn’t work, maybe check:

How long is the pick up sound? Not just the audible part, but even the silent part (if any). If the sound file is longer than the sound itself it may be blocking the new sound from happen.

I hope it works.

1 Like

Yo this worked. Right on bro. @oscuridad666

Edit: To answer your question, the sound is half a second long at most and I trimmed the silence at the end with Audacity.

1 Like