How to add a score tracker in an if/else statement for a multiple choice game, and a few other things
//this is what I have so far.. just wondering where and how I'd put the rest for the score tracker? I'm going to be making 3 of these multiple choice questions, so what would be the best way I lay that out and transition from one question to another? a开发者_JAVA技巧lso, I'm wondering what a boolean is and if that would help me for making an answer not case-sensitive. Thanks a lot!
btn.addEventListener("click",button);
function button(click) {
var answer:String=input_txt.text;
if (answer=="") {
output_txt.text="Correct!";
} else {
output_txt.text="Incorrect";
}
}
Have a variable called score, increment it a certain amount each time a correct answer is chosen.
A boolean is a variable that is either True or False. If you want make the text non case sensitive, you can use the stringName.toLowerCase() method.
精彩评论