如何在多项选择游戏的 if/else 语句中添加分数跟踪器以及其他一些内容

发布于 2024-10-07 15:20:14 字数 349 浏览 0 评论 0原文

//这就是我到目前为止所拥有的..只是想知道我将把其余的分数放在哪里以及如何放置在分数跟踪器上?我将做 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一梦等七年七年为一梦 2024-10-14 15:20:15

有一个称为分数的变量,每次选择正确答案时将其增加一定的量。

布尔值是一个要么为 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文