so how can i get 'PlayAudio ( )'
to still play the background music, but also play say a jump sound when jump is triggered, but only play it once per jump instead of playing 1 sound then overlapping another sound & overlapping another sound?
This is the 'AddAudio ( )'
function & the 'PlayAudio ( )'
function :
this.AddAudio = function ( __objData )
{
this.__objData = __objData;
this.__snd = this.__objData.sound;
this.__key = this.__objData.key;
this.__config = this.__objData.config;
if ( typeof ( this.__objData ) !== 'object' ) { return console.error ( 'ERROR :: { Please ensure you are using an `object` for `objectData` & try again } !' ); }
this.__currentSound = this.__snd.add ( this.__key, this.__config );
return this.__currentSound;
}
this.PlayAudio = function ( __objData )
{
this.__objData = __objData;
this.__sound = this.__objData.sound;
this.__record = this.__objData.record;
if ( typeof ( this.__objData ) !== 'object' ) { return console.error ( 'ERROR :: { Please ensure you are using an `object` for `objectData` & try again } !' ); }
__currentSound = this.AddAudio ({
sound : this.__sound,
key : this.__record.key,
config : this.__record.config,
});
__currentSound.play ( );
}
This is how they’re called :
// *** INSIDE the 'PlayAudio ( )' function :
__currentSound = this.AddAudio ({
sound : this.__sound,
key : this.__record.key,
config : this.__record.config,
});
// *** OUTSIDE the 'PlayAudio ( )' function :
__m.PlayAudio ({
sound : this.__sound,
record : __soundfx [ 0 ],
});
Any help as always is most appreciated!