Adding up timed levels

Get help using Construct 2

Post » Sat Mar 24, 2012 1:26 am

Hello, I usually don't ask for help but after 72 hours of searching trying, and failing I have become very stressed. So I am asking for some help please.

Ok, I have been making a game for the HBGames.org's BUILD & WIN Construct 2 Contest. So far my game has 5 levels, and what I am trying to do is add a simple timer to act as a scoring system.

After many failed attempts at this I finally got close when I found this thread Restting Local Variables were Kyatric posted this commented capx.

So what I used from it was I made 2 global variables one named Score this one is a text variable, and the other named TimeLevel this one is a number variable.

The timer works great, and resets to 0 after each level then adds the levels time to the Score variable. But at the end of the game when you are taken to a score page instead of adding up all the level scores it just lists them in order next to each other like 34, 56, 72, ect.

So my question is what am I doing wrong? :( How do I make each level score add onto each other to get a total game time to display on the score page?

Any Help would be greatly appreciated like I said earlier I don't like to ask for help but I really need it. Wink2012-03-24 02:02:54
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Sat Mar 24, 2012 2:24 am

Could you add a 'score_so_far' variable, which you add on to at the end of every level?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Mar 24, 2012 3:06 am

Thank you sqiddster for your suggestion but that didn't work for adding each level's time into one total game time. But you did help me figure out a solution, and also gave me another Idea for my game :D

First the solution in case anyone else is ever searching for how to add up all the levels times into one. What I did was changes my Score variable form text to number. Then I set up my game to add 1 to my Score variable every one second. Just like I did for my timer to my TimeLevel variable. Except with my Score timer I didn't set it to reset to 0 each level. It's basically two timers keeping the same time except one only keeps each levels time while the other keeps total game time. I hope this makes sense anyway it works :D

And the new Idea you gave me was to maybe use your 'score_so_far' variable to add each levels time to a level select page. So that once a level is completed, and unlocked a player can see his or her level time. Then select that level, and try to get a better time. Of course this idea will need some server side scripting, and a database. I probably wont try this until after the contest.

But thanks again sqiddster :D
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Sat Mar 24, 2012 6:34 am

have a global variable set to Zero, try after the game.
Set Value to time value. just make sure you dont reset it.
only reset the time to be reuesed.Erndog2k2012-03-24 06:34:37
B
27
S
11
G
1
Posts: 246
Reputation: 5,048


Return to How do I....?

Who is online

Users browsing this forum: getplay and 25 guests