Why is the music lagging? Plz help

Hey everyone, so here’s a game I made recently. Press A to enter buildings. However, each setting has a different piece of music, but it doesn’t change right away until the prevoius piece of music is FINISHED playing. Anyone know how to change that? Thanks so much ~

This happened to me to and it also lagged my game, im not sure why

I am not very familiar with sound/melody, but hope this can help, before experts of this field have time. Then I tried your project and studied play/stop melody a little.

  • Every call “play melody()” return and go to next codes until it play complete, in other words, like “play until done”.
  • The “stop all sound” can work immediately.
  • But the next “play melody” in the forever did work, after the stop(), which is belong to last building/lobby still.

So we need a mechinism that check the building/lobby change, after each one melody playing. Quit out the forever, if changed. And then enter again with new building melody list.

So I changed following:

  • define melodies list and BPM in each building/lobby entering blocks
  • in the forever, save current building/lobby (the path in your case)
  • check it changing after each playing.

image

1 Like

Thanks so much for all your hard work @AqeeAqee! You really helped me out here a lot. You guys are the best!

1 Like

check the code again, that might help… will it did help on mind

Welcome!
Very happy that clear some barries of you guys as far as I can, and looking forwad for your imaginative games!