Adding multiple variables

Get help using Construct 2

Post » Tue Sep 04, 2012 3:51 pm

Hi Guys,

I've had a trawl through the forum but can't seem to find an answer to my problem.

I have 3 levels, each with its own global variable for the level score.

When the you die / complete the game, there's a final score layout, only I'm having headaches trying to add the 3 global variables up.

For example:

endScore=LevelOneScore+LevelTwoScore+LevelThreeScore ?

Any help is much appreciated, mainly to stop any more hair falling out! :D

And a big thanks to all the posts here for teaching me so much, you look like a good bunch!
B
3
Posts: 4
Reputation: 383

Post » Tue Sep 04, 2012 5:13 pm

Forgot to add, the formula I'm looking for is the one like this:

Scoreboard Layout...

System | Every Tick | endScore | Set text to ""&Score+Score2+Score3

What am I doing wrong?swiss2012-09-04 17:16:13
B
3
Posts: 4
Reputation: 383

Post » Tue Sep 04, 2012 5:27 pm

Try this for the set text: str(int(Score) + int(Score2) + int(Score3))
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Tue Sep 04, 2012 6:15 pm

Hello Jayjay,

Thanks for your quick response, I tried:

str(int(Score) + int(Score2) + int(Score3))

and

str(int(Score)+int(Score2)+int(Score3))

...but it only seems to show the score from the level I was on, it doesnt add the score from previous level(s) to the end score, any ideas why?
B
3
Posts: 4
Reputation: 383

Post » Tue Sep 04, 2012 6:39 pm

I'd say you're doing the set text part right. Most likely the scores are 0 because they aren't being set properly or are being reset somewhere.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Tue Sep 04, 2012 6:44 pm

Hi Ramones,

Makes sense - Jayjay's answer looks the part.

So if I complete layout 1 (level 1) and move on to layout 2 (level 2), why isnt the global variable "Score" being remembered? On all event sheets, at the top is "reset all global variables" but I wouldnt have thought that applies when you leave it to go to a new layout?

This is the first time I've done more than one level so I'm still learning!
B
3
Posts: 4
Reputation: 383


Return to How do I....?

Who is online

Users browsing this forum: Callan S, gamecorpstudio, getplay, Kagubro, Yahoo [Bot] and 16 guests