How do I Calculate The Score Has Reach An Increment of 10000

Get help using Construct 2

Post » Mon Dec 22, 2014 7:52 pm

I want to give an extra life bonus each time a player has reach a score more than 100,000, 200,000 and so on. How to calculate this?
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Mon Dec 22, 2014 7:59 pm

The first thing that comes to mind is a separate Variable to which you add your limits. So...

ExtraVariable = 10000

If Points > ExtraVariable --- Add extra life, Extravariable = Extravariable + 10000

This way every time the score jumps over the limit you give an extra life and raise the limit.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Dec 22, 2014 8:11 pm

Yea, that works. Thanks
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Mon Dec 22, 2014 8:24 pm

Another option:

if SCORE % 100000 = 0 add 1 to LIVES
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 408
Reputation: 2,297

Post » Mon Dec 22, 2014 8:30 pm

Bruno, wouldn't that only work with exact increments?
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Tue Dec 23, 2014 1:51 pm

Yep. You're right. My fault. Duh!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 408
Reputation: 2,297

Post » Tue Dec 23, 2014 3:26 pm

Actually, Bruno's solution is efficient, if the score point is only +10000, so it will hit the increment 100.000, 200.000, etc.
And somebody's solution is great for score point that is vary.
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Tue Dec 23, 2014 3:39 pm

My solution also overcomes possible lag issues, etc where there's a chance of "skipping" the exact figure. Modulus was the first thought here as well, but then I thought "what if he score isn't perfect" - hence that solution.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Tue Dec 23, 2014 4:48 pm

Yep. i'd go with @Somebody 's solution. :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 408
Reputation: 2,297

Post » Fri Dec 26, 2014 8:32 am

I was going say make a variable of 100,000, every point subtracts 1 from that variable. When it hits 0 add one to lives reset variable.
B
7
S
1
Posts: 57
Reputation: 728


Return to How do I....?

Who is online

Users browsing this forum: MikaelS, nahima, Shenkai the ssj and 23 guests