It could be that you were setting starting values using the initialize blocks on each screen. I don’t usually do that and it won’t work if you are using global variables as I’ve suggested. Instead, on each screen, when the screen opens set each variable to the starting value. So for example, set app variable score to 0.
If you need help with getting that working, post a new link to your project.
Hey, Ive found a solution for my 1st quest screen (Screen3L1G1_Q1-5). Ive put the L1G1 back on the Question and Answer Lists plus the 2 initialize blocks and the Score works now. What do you think must I do with the 2 following screens?
Hi Tatiang. Sorry, I used the wong words (at 3am this morning!). I actually meant that I found the REASON why the score does not work on al 3 screens, but hoping you’ll have a more efficient way than my previous L1G1 way that caused all the unnecessary changes and blocks. I just dont know how to try or setup other type of blocks instead. I will thus just wait for you to reply first.
Once you initialize a variable, it can be used on any screen. If it seems more difficult or confusing, I would encourage you to code the app the way you understand it. Introducing complicated methods – even if they are more efficient – is sometimes not the best idea.
That being said, I’m not sure how else to explain it but I will try:
If we step away from your project for a moment and consider a math quiz where each screen has a different question, you could initialize app variable correct answer count to 0 on the first screen. Each time the user chose the right answer, you could increase app variable correct answer count by 1 and display it in a label.
If you were making the screen for question #1, you would do this:
If app variable ChosenAnswer = app variable correctAnswer
then change app variable correct answer count by 1.
For the screen for question #2, you would use the exact same code:
If app variable ChosenAnswer = app variable correctAnswer
then change app variable correct answer count by 1.
Those three variables could be used on any screen where you need to set up another question. It’s not necessary to initialize another three variables on every screen.
Hi Tatiang. I did put the 3 variable blocks on the 1st screen only and it worked perfect.
But my other 2 screens’ scores did not work.
Maybe a stupid question, but shouldnt there be an
app variable SelectedQuestionEmojiList and a app variable SelectedAnswerEmojiList
on the 1st screen as well ??? (Because I noticed that those 2 did not change as all the other variables did change. Just asking).
And can a person delete all the previous/unwanted variable blocks and how?
When you initialize a variable, you give it a name and a container is created in the app’s memory. You can then set or get the value of that variable on any screen after that. So if you are needing to change the value of SelectedQuestionEmojiList on a screen, you would need to set its value on that screen (you should do that on every screen where you have a game).
Yes, you can right-click on a block to delete it or you can drag it to the trash can icon at the bottom-right of the screen or you can drag it to the sidebar on the left side of the screen.
Hi Tatiang. Im now at a stage where the question and answer of quests are 2 different emojis on the 2 buttons (e.g. a pig and a pig head) for my Match the Animals Group and later on I will have a word or a number on the question button and an emoji on the answer button. What must I do so that the score count will work on these different looking emoji buttons and the other word or number matching buttons later? (the button names e.g. Question1-L1G6 and Answer1-L1G6 doesn’t work).
But it doesn’t make sense to me. The idea is to check if the number of times the player has clicked is 0, 1, or more than 1, as I showed here.
You have to be careful because you have many variables with same names. It’s more important than ever to make sure you are choosing variables that end in the right level and game such as L1G6.
As you move from exact matches to pattern matching (for example, a horse and a horse’s face), the coding gets more complicated. I can tell that you’re having a hard time understanding the logic I’ve set up. I don’t know how much more I can help you with this with how complex it’s getting. I don’t mind you asking more questions, of course, but I may not be the one to answer them.
I think the best thing I can do for you at this point if you are planning to make more screens with pattern matching is to create this one screen the way it should be and then have you make a duplicate of the screen when you need to add another pattern matching game. The only thing you should change about that duplicated screen is the contents of the list items for these two lists:
The Right Side Correct Order List should be initialized to the order matching the left side (pig, pig, horse, horse, etc.). Do not change any variable names or add or remove any variables blocks.
WOW Tatiang! You are a genius! I can’t thank you enough for all the effort that you’ve put in to help me. It works perfect! PLUS the way you have named the variables makes it easier to understand AND WAY FASTER TO DO EACH SCREEN!
Can I copy this same screen’s blocks for my next Match the DUPLICATE Emoji buttons?
You are a leader in many ways. THANK YOU for your kindness. May others learn from you.
You’re very welcome! I’m glad you’ve found it helpful. I hadn’t thought about your question when I made those blocks but it should work for a duplicate matching game.
Hi Tatiang, i found now at Screen 22 that although all the screens’ score counts worked well after I created each, it now does not work anymore. I noticed that each last created screen’s score count only works until I create a new screen. What could be the problem?
Take a look at your Variables drawer. How many “score” variables do you have? Are there more than one with the same name? That will cause problems because the code may look correct but you may be referencing the wrong variable block.
You can post an updated link to your project and I can take a look. If the coding is much different from what I provided as a template, I don’t know if I’ll have the time to delve into it but I can try.