Phaser 3 Sound Mananger

Managing Sounds in Phaser 3

I like to build a lot of games quickly. One of the things I do to speed up the process is to keep a library of game Parts. These are the things that I would find myself writing over and over.

Playing sounds in Phaser 3 is rather quite simple. With a little extra work, we can make the music Loop and put in background music as well. What is a little more complicated is if we give the players controls to turn on and off the sound effects and music. After having done this for the 100th time I finally got around to writing this class that will handle all those details for you.


What is the Sound Manager

A collection of toggle buttons to turn on and off the sound effect and music. Integrated with the buttons is some code to stop and start media based on user input. Easy to add your own images and icons to customize the look to fit your game.

How to use

  1. Preload the icons, toggle button, and the audio

2. Make an instance of the Sound Manager class

You’ll need to pass in the scene and the key for the toggle button in an object

3. Set the background music

Just pass in the audio key

4. Play a sound effect

Just add one line of code in your game when you want to play a sound effect

That’s it! The sound manager will take care of the rest!


Name your price $