How do I get score to work in game?

Hi!

I cannot figure out why I can’t get the score to work in my game. The object of the game is to run around and try to grab cash falling from the sky. I have that working, but cannot get the score variable to work.

Also, I cannot seems to set the Cash Guy sprite to stay at 409 on the Y axis. Any help you can give me is very much appreciated.

https://x.thunkable.com/projects/5d8972384760701c6c5a539f/3e86974d-b718-4175-809f-79f8b7609fab/blocks

Debbie

hi,

I can not get the score to work in my game

If you do not update the score on the screen, it will not be displayed.

Your project can be made a lot easier, but now Canvas very raw and beautiful do not work - does not work animation on a hidden sprite, not working movement of the sprite in the negative coordinate, on Android has some pull is enough sprite in a collision. On iOS more or less works well.

Also, I cannot seems to set the Cash Guy sprite to stay at 409 on the Y axis. Any help you can give me is very much appreciated.

Yes, it seems there is no way to fix the Y-coordinate

I do not understand what you mean by I have to update the variable score. I have set up my score the same way the 3 examples are set up in the documentation https://docs.thunkable.com/gaming

That’s what the “change app score by 1” block does. It just does not seem to work with this file for some reason. I have tried deleting it and putting it back in but cannot make it work.

Debbie

@actech Could you please file bugs for each of the issues that you see in the Canvas/Sprite components? That’s the best way to get them fixed :wink:

Thanks in advance.

-Mark

Debbie,

Updating the value of your Score variable does not also update the Text property of the label component that displays the score. Each time that you update your Score variable you also need to update your label component’s Text property. You’ll see that that is what is done, for example, in the “Flappy Ball” game.

-Mark

P.S. It would be nice if the value of the label component’s Text property were able to be automatically updated when the Score variable changes. That’s a feature (we call it “binding”) that we have on our list!

1 Like

Oh, thank you! Thank you so much! Now I understand. I thought I had that covered with putting “set label4 text to app Score” on the when screen opens. Now I see I have to put it everywhere the Score variable changes. I do not have to do that on other programs that I have worked with, so I never would have thought of it. Thank you so much for taking the time to explain it to me. :smiley:

Debbie

1 Like