How do I add the remaining time to score

Just started using Construct 2? Post your questions here

Post » Thu Feb 04, 2016 1:08 pm

I've searched the forum, read the manual but I couldn't find an answer. I want to convert the remaning time (it's a time critical game) into points and add it to the score. Any ideas? Thanks in advance.
B
6
S
1
Posts: 7
Reputation: 430

Post » Thu Feb 04, 2016 2:43 pm

Hi,
You probably have a "time" variable in your project. When the player succeed the level just put a new event :

system > add to > score

And add the remaining time value to the score.
You could also enter time*10 or such things.

Hope it helps! Good luck!
B
32
S
6
G
1
Posts: 352
Reputation: 2,812

Post » Thu Feb 04, 2016 2:51 pm

Hi Rable, thanks for the reply. I do have a "time" variable (set to 10) and I already did what you say, but the value added to my score is the entire "time" value (10), not just the remaining time. For example, if the player finished the task in 4 seconds it will add 10, not just 6 as I want.
B
6
S
1
Posts: 7
Reputation: 430

Post » Thu Feb 04, 2016 3:01 pm

So I suppose you never decrease the time?
You can do :

system > every X seconds (every 0.1 second for example)

add an action > system > subtract from
and you subtract 0.1 from your time variable.

Now your time will decrease by 0.1 every 0.1 second and the code above will work. ;)
B
32
S
6
G
1
Posts: 352
Reputation: 2,812

Post » Thu Feb 04, 2016 4:09 pm

The time is decreasing, but I figured what I was doing wrong: I was reseting the time right after the event ended and before the "add to score" event, so obviously the time added would be 10. I changed it and I set the timer to reset on the begining of the next event, now it's woorking.
Thanks a lot for your help!
B
6
S
1
Posts: 7
Reputation: 430

Post » Sun Jul 23, 2017 8:08 pm

Rable wrote:Hi,
You probably have a "time" variable in your project. When the player succeed the level just put a new event :

system > add to > score

And add the remaining time value to the score.
You could also enter time*10 or such things.

Hope it helps! Good luck!


this worked for me thanks!
B
9
S
2
Posts: 104
Reputation: 975


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 5 guests