How to add a score to a game in Thunkable X

I’m having trouble figuring out how to add a score to my game in Thunkable X. For example, changing the number of coins you get when you press yes or no on an alert. Can someone please help me?

When click yes button (was confirmed block)set the from coins get text + 1.then set it’s variable with stored. :thinking:

2 Likes

Something like this
Screenshot_2019-09-13_071942
https://x.thunkable.com/projects/5d7ad1a1a3f63268b468d81f/7d3e2ce3-7a2c-4f9e-aa33-6a65ca53fac6/blocks

7 Likes

Thank you so much, you’re a life-saver! :grin:

5 Likes

hello…can anyone help me with adding score of player 1 and player 2
here is the link
https://x.thunkable.com/copy/893bfc1089bfe0e30d0ed2fb680024d4

When you post a question, especially if it includes a link to a project, please explain the problem you are having and where we might look (which screen, which label or other component, which blocks) to find it.

2 Likes

The problem is that these two variables are different when they should be the same:

2 Likes

So I am building an app called dice war in this app there are two players (Player1,Player2).
The First Chance is of player1,So the player1 should click on Check The Dice Number when he clicks it the app shows the dice number which = player1 Score, So just like this the player2 also plays next it will be again player1 turn zo when he clicks on the button the app shows the dice number , now the app should add the Scores but I don’t know the codes for that.
SORRY for the not explaining properly here is the link now
https://x.thunkable.com/copy/9c653aff7d4cbaebddfcd46e86d8023b

It would be good if you could explain what a few rounds look like. For example:

Player 1 rolls 3
Player 1’s score = 3
Player 2 rolls 5
Player 2’s score = 5

Player 1 rolls 6
Player 1’s score = 9
Player 2 rolls 1
Player 2’s score = 6

Is that how it’s supposed to work?

2 Likes

yep

Then you need to add some addition (+) blocks in order to add the number that was rolled to the current player’s total.

3 Likes

can u tell me the codes

Have a look in the math drawer. You’ll find the blocks you need for adding values together. :slight_smile:

3 Likes

ok …should I create a variable as Score then
should I add the variables number and Score = Player1 Score

Sounds good!

1 Like

Is it correct ?

I said it sounds good but you should try it to make sure it works for you.

1 Like

ok

Is it the way I told
Screenshot 2021-05-25 112013

That’s going to take the number that was rolled and add it to the score and then save that value as the number variable. I don’t think that’s what you want!

To translate what you wrote, you would have blocks that say:

Number + Player 1 Score = Player 1 Score

But since Thunkable works left to right, your blocks should be:

Set Player 1 Score to Player 1 Score + Number

You’re also going to need separate variables for each player’s score (Player 1 Score and Player 2 Score).