// ANIMATE CELEBRATION with STAR SETS ///////////////////////////////// var stepstars = 0; var stepstarsmax = 4; var imagename; function ShowStars() { if (stepstars > 0) { imagename = "step" + stepstars; document.getElementById(imagename).style.visibility = "hidden"; imagename = "adim" + stepstars; document.getElementById(imagename).style.visibility = "hidden"; } if (stepstars <= stepstarsmax) { stepstars = stepstars + 1; } if (stepstars <= stepstarsmax) { imagename = "step" + stepstars; document.getElementById(imagename).style.visibility = "visible"; imagename = "adim" + stepstars; document.getElementById(imagename).style.visibility = "visible"; setTimeout(ShowStars, 200); //75 } if (stepstars > stepstarsmax) { stepstars = 0; } } // PLAY AUDIO ////////////////////////////////////////////// function PlayAudioFile(action) { // act++; // var i = act % 2; // numberOfCards // i++; // var controlname = ""; CalculateScore(action); // calculate score based on action var sound_file; if (action == 'w') { document.getElementById('audio-win').play(); } else if (action == 's') { sound_file = 'cheftile.mp3'; } else if (action == 'r') { sound_file = 'boip.mp3'; // controlname = "ar" + i; } else if (action == 'c') { sound_file = 'correct.mp3'; // controlname = "ac" + i; } //if (controlname == "") { // // //} else { // document.getElementById(controlname).play(); // document.getElementById("trace").innerHTML = controlname + '
' + document.getElementById("trace").innerHTML; //} if (sound_file) { var html5_audio = new Audio(sound_file); //var html5_audio = new Audio(); //var src = document.createElement("source"); //src.type = "audio/mpeg"; //src.src = sound_file; //html5_audio.appendChild(src); html5_audio.play(); } } function PlayGameOver() { document.getElementById('audio-loose').play(); } function PlayBonus() { document.getElementById('audio-bonus').play(); } function CreateAudio() { var str = ""; var i = 1; while (i <= numberOfCards) { str = str + ''; // audio correct i str = str + ''; // audio wrong i i++; } document.getElementById("audio").innerHTML = str; }