score disappears in game
to anyone whom can help:
this is a lesson I'm doing for a class except the tutorial doesn't cover the response to this scenario. My score disappears once the game is in execution mode. I've seen forms suggesting the placement of a .embed code (not specific where) I've also seen a suggestion to change font which i've done and nothing has happened. I don't want to disrupt the code from the lesson to much so any suggestions to what I may be missing I appreciate.
thank you.
//Setting up the game variables
userChoice = "none";
userComp = "none";
//Setting up score variables
Wins = 0;
Losses = 0;
Draws = 0;
Tries = 0;
//control variable
control = true;
//Initial hideLogos call
hideLogos();
function hideLogos()
{
//Hiding our logos
this.StatWin._visible = false;
this.statLose._visible = false;
this.statDraw._visible = false;
}
//Choose functions
function choose(newChoice)
{
//If we have control, run the game
if (control)
{
hideLogos();
userChoice = newChoice;
trace("You've have selected " + userChoice);
rndChoice = Math.ceil(Math.random() * 3);
//trace ("Random number : " + rndChoice) ;
switch (rndChoice)
{
case 1 :
compChoice = "Rock";
break;
case 2 :
compChoice = "Zors";
break;
case 3 :
compChoice = "Paper";
break;
}
trace("Computer selected" + compChoice);
Object(this).scarecrowUser.gotoAndPlay(userChoice);
Object(this).scarecrowComp.gotoAndPlay(compChoice);
control = false;
}
}
function gameLogic()
{
if (!control)
{
if ((userChoice == "Rock" && compChoice == "Zors") || (userChoice == "Zors" && compChoice == "Paper") || (userChoice == "Paper" && compChoice == "Rock"))
{
//Result is victory
trace("You've won!");
this.StatWin._visible = true;
wins++;
}
else if (userChoice == compChoice)
{
//Result is draw
trace("it's a draw");
Object(this).statDraw._visible = true;
draws++;
}
else
{
//Result is loss
trace("you've lost :(");
Object(this).statLose._visible = true;
losses++;
}
tries++;
control = true;
}
}
//Functions for the buttons
Object(this).btnRock.onPress = function()
{
choose("Rock");
};
Object(this).btnPaper.onPress = function()
{
choose("Paper");
};
Object(this).btnZors.onPress = function()
{
choose("Zors");
};
