Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by JackImpact

Hi All,

anyone knows how to control the volumes of the background music and sound effects separately? I would like to put two sliders in the game, one to adjust the background music's volume, the other one is to control the volumes of sound effects.

Any idea how to do this properly? I managed to create two ig.Music instances in the main and add tracks for bg and effects separately. I also use two jquery sliders to control the volumes successfully. The problem is I can't control the loop of track. For the music, I want them to loop. For the sound effects, for most of them, I want them only play once while some will loop. I know that there is a boolean of loop for the ig.Music. But it only control loop of the whole collection, not the individual track. What I want is to control the loop of individual track....Currently my sound effect such as bullet shooting keep looping, how to make it play only once?

Any help will be appriciated.

1 decade ago by coreysnyder

For Music you can do:
ig.music.add( 'music/track1.ogg' );
ig.music.add( 'music/track2.ogg' );
ig.music.add( 'music/track3.ogg' );

ig.music.volume = 0.5;
ig.music.play();

See the documentation here: http://impactjs.com/documentation/class-reference/music

For sound you can configure that too via the volume property. See link below.
http://impactjs.com/documentation/class-reference/sound
Page 1 of 1
« first « previous next › last »