How do I Time score

Get help using Construct 2

Post » Fri Sep 11, 2015 4:40 pm

Hello, I have a timer and score and I would like for example. Maximum score you can win = 1000. If it takes 1 second = 1000, 2sec = 999 3sec = 998 something like that. I've tried it and nothing.

Anyone know how to do this without putting a thousand times the same :lol:
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Fri Sep 11, 2015 4:53 pm

some event that starts your game:
gametime_start = time

some event that ends your game and assigns the score:
set score = 1000 - int(time - gametime_start)
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Fri Sep 11, 2015 6:00 pm

have a compare game time event.
on gaining the points score=score + (1000 - round(time))

at least that would be 1000- (1 per second of game time)

can be reversed so you gain more points the longer you are alive for if that helps
B
9
S
3
Posts: 102
Reputation: 987

Post » Fri Sep 11, 2015 7:04 pm

You can put it like an event? I am a bit lost :x

I do not need to create any variables not?
I Have Score - Highscore - Timer...
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Fri Sep 11, 2015 7:35 pm

as an event
score=score + (1000 - round(time))

just typing "time" counts as the game time from start of layout
round stops it from being a decimal.

if your aim is to get to 1000, the more time alive, the larger the score added
score is a global variable
as an event : every (1) second --------- score = score + time

then have a text box somewhere with the event: everytick---------text set text to ""&score

this will make it so on 1 second, 1point is added ----score=1
on 2 seconds, 2 points are added ---- score =1+2 (3)
on 3 seconds, 3 points are added --- score = 3+3 (6) etc

the other thing i typed would add a value thats less every second....
1second score= 999
2seconds score=999+ (998) etc
B
9
S
3
Posts: 102
Reputation: 987


Return to How do I....?

Who is online

Users browsing this forum: davidbox, Mayfly, Yahoo [Bot] and 4 guests