Hi guys!
Now my new game - Halloween Stories: Mahjong - is released. And this is the my first game developed using HaxeFlixel!
var Sounds:Array<FlxSound>;
var EmbedSounds:Array<String> = ["Crash","Boom","Bang"];
////////////////////////////////////////////////////////////////////////////////
function InitSound()
{
Sounds = new Array();
for (i in 0...EmbedSounds.length)
{
Sounds.push(new FlxSound());
Sounds[i].loadEmbedded(EmbedSounds[i]);
}
}
////////////////////////////////////////////////////////////////////////////////
function PlaySound(_sound:String)
{
var index:Int = EmbedSounds.indexOf(_sound, 0);
if (index != -1)
{
Sounds[index].stop();
Sounds[index].volume = SoundVolume; // In case that the volume level was changed (it can be changed during sounds playback for example)
Sounds[index].play();
}
}
////////////////////////////////////////////////////////////////////////////////