Applab - Game with score

Hi all
I"m trying to have my top students (12 Year olds) create a variable to keep score of a quiz/questionaire.

Link to the project or level: https://studio.code.org/projects/applab/mgRIhZiAHuGWHnw7qzU61hpSwM2iZuIWY-gVt_lXM6k.
**What I expect to happen:**She has created the variable, but can’t seem to get it showing on the screen. When the user clicks on the relevant button, the Points should go up by 1.
What actually happens: Nothing.The display doesn’t show.
What I’ve tried: She has tried many tutorials and tried researching options. Any suggestions welcome!!

I love this app. It is starting to come along. It’s incredible for a 12 year old!

Just a few suggestions for your student. First of all, her block on line 15 is declaring the point variable for the 2nd time. (It was already declared on line 1). So, she should remove the word “var” from line 15 so it reads point = point +1;

Then, the value will be stored in the variable, but she also needs to use a “setText” block to set the value of the text in her “Point Base” element to display the point value.

Here’s a link to the documentation for the “setText” code. Although, I must say this goes beyond what is taught in CSD, it looks like a great challenge for her!

https://studio.code.org/docs/applab/setText/

Let us know if we can help further or if what I’ve suggested doesn’t make sense.

Good luck!

Mike

1 Like

Also, there is a link on the documentation page for the setText element that links to a lesson in CS Principles that shows students how to build a counter. Since her app is similar, she may want to look at that. It’s on the setText documentation page and here’s the direct link:

Mike

Hi Mike
Thanks so much for this help … I’m new to this content as well so I’m learning a few hours ahead of the students :-). With regard to the setText code, I’ve given the ‘text’ as the variable name (ie. “point”). But it just comes up with the word “point” rather than the variable value. Sorry if this is a silly request … beginner here:-). Here is the version I’mplaying around on:

Aha! So close. Remove the quotes from “point” in your code on line 2 and it will display the value of the variable rather than the string “point”.

Also, consider where you want that setText code to be placed. If you leave it on line 2, it will display the point value one time at the beginning of the game and not every time the score is updated which is probably when you want it to display.

You can actually declare a starting value for the input box in the design tools where it was created.

Not a silly request… App Lab is a bit tricky until you get used to it and I’m nowhere near an expert myself…

Mike

3 Likes