I’ve used flash for websites, but never for games. I’m an illustrator not a developer so I know my script is messed up somewhere. The simple concept of the game is to blow out all the candles on the cake. The timer works and so does the score, but when the score hits 10 i want it to go to and play “happyBirthday”. When the time runs out it does go to “playAgain”, but when round two comes up, the blownout candles are not lit again… so for some reason, its not resetting and the timer begins at 0 and decreases (-1,-2,-3 etc.). What am I doing wrong?
here is the script:
function gameScoreAdd()
{
gameScore = gameScore + 1;
if (gameScore == 10)
{
clearInterval(timer);
stopAllSounds ();
gotoAndPlay (“happyBirthday”);
} // end if
} // End of the function
function countDown()
{
–gameTime;
if (gameTime == 0)
{
clearInterval(timer);
stopAllSounds ();
gotoAndPlay(“playAgain”);
} // end if
} // End of the function
function resetGame()
{
gameScore = 0;
gameTime = gameTimeMaster;
} // End of the function
gameTimeMaster = 15;
resetGame();
Here are the varibles:
var my_sound = new Sound();
my_sound.attachSound();
my_sound.start(0, 1000000);
timer = setInterval(countDown, 1000);
var score:Number = 10;//declare score variable
Appreciate any comments/suggestions!