如何在多项选择游戏的 if/else 语句中添加分数跟踪器以及其他一些内容
//这就是我到目前为止所拥有的..只是想知道我将把其余的分数放在哪里以及如何放置在分数跟踪器上?我将做 3 个多项选择题,那么我最好的方式是什么?从一个问题过渡到另一个问题?另外,我想知道布尔值是什么,这是否有助于我做出不区分大小写的答案。多谢!
btn.addEventListener("click",button);
function button(click) {
var answer:String=input_txt.text;
if (answer=="") {
output_txt.text="Correct!";
} else {
output_txt.text="Incorrect";
}
}
//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? also, 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";
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个称为分数的变量,每次选择正确答案时将其增加一定的量。
布尔值是一个要么为 True 要么为 False 的变量。如果您想让文本不区分大小写,可以使用 stringName.toLowerCase() 方法。
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.