Python Forum

Full Version: Play Audio While continuing Gameplay
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am new to game development.

I am making Snake game as my first game project. I want to play audio when snake eats food.

I tried doing using this:

from playsound import playsound
playsound("D:/Projects/Pygame/food.mp3")
When Snake eats food, sound is played but game freezes until sound is finished. How do i play sound and also continue gameplay at sametime? Do I need to use threading?
If you're using pygame for graphics, you should also use it for sound: https://www.pygame.org/docs/ref/mixer.ht...ixer.Sound