How do I add multiple points to my scoreboard

Get help using Construct 2

Post » Fri Mar 10, 2017 10:43 am

hello. Newbie here.
i 'm making a game with questions and answers.One question with 7-8 correct answers. Each correct answer gives specific points. i set text1 "0" when game starts.

EXAMPLE :
when answer is correct i use : event -> textbox /compare text "LION" / action -> text1 /set text "10"

so when you type LION in the textbox you take 10 points in text1.

Problem is i can't add the points of all answers using this way.It keeps only the points of one answer.

any help around ?
B
3
Posts: 11
Reputation: 197

Post » Fri Mar 10, 2017 12:06 pm

You need a Global Variable to keep track of your score.

Create a Global Variable and call it Score.

Global Variable Score = 0

Now each time they get a correct answer use Add To in the systems command to add it to Score.

On Correct Answer: Add To Score +10

Then set the text to the Score variable with no quotation marks

Set Text1 to Score
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Fri Mar 10, 2017 12:38 pm

i will try it but i want to mention that not all answers give +10 score. some give 10 some give 20 etc.

thanks anyway
B
3
Posts: 11
Reputation: 197

Post » Fri Mar 10, 2017 12:45 pm

vagos88 wrote:i will try it but i want to mention that not all answers give +10 score. some give 10 some give 20 etc.

thanks anyway


Doesn't matter as long as you add that amount of points to Score it will still keep track of score and that is the way to do it.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Fri Mar 10, 2017 1:24 pm

i created the global variable and used the Add To in correct answer. But how i display the Score in text1 ?
B
3
Posts: 11
Reputation: 197

Post » Fri Mar 10, 2017 1:27 pm

vagos88 wrote:I found the Add To in system. But how i display the Score in text1 ?



Like I said above:

Set Text1 to Score

No quotation marks. Score is whatever variable name you are using to keep track of the score.

It will appear as a number in the text you created.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Fri Mar 10, 2017 1:41 pm

i cant understand what "Set Text1 to Score" means. where i do this ? in event sheet ? in object text1 ?
B
3
Posts: 11
Reputation: 197

Post » Fri Mar 10, 2017 1:46 pm

vagos88 wrote:i cant understand what "Set Text1 to Score" means. where i do this ? in event sheet ? in object text1 ?



From your OP"

"action -> text1 /set text "10"

So you have a text on your screen named text1 to hold the score right?

If not you need to create a text to hold the score.

Then click on that text in the events and look at the bottome where it says SET TEXT.

Click on that and it will show two quotation marks. The quotation marks are only used to set the text to words or characters not to a number.

Delete the quotation marks and use your Score variable instead.

Set Text to Score

No quotation marks.

If you have a very large number you will need to make the text box on the layout large enough to hold that number or it will not show up when you run the game.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Fri Mar 10, 2017 2:05 pm

I did it but no results. When i type correct answer in textbox it shows 7 points. Then i type again another correct answer for 10 points. But it shows 10 on score. not 17


Image
B
3
Posts: 11
Reputation: 197

Post » Fri Mar 10, 2017 2:20 pm

vagos88 wrote:I did it but no results. When i type correct answer in textbox it shows 7 points. Then i type again another correct answer for 10 points. But it shows 10 on score. not 17


Image


You don't set the text to a number. You add that to the Score variable and set the text to the Score variable.

Image
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Next

Return to How do I....?

Who is online

Users browsing this forum: FlyingRam, jkmalau, MadSpy, Manubis and 12 guests