# How do I add 1 Value per 1,000,000 Points

Get help using Construct 2

### » Sat Jul 23, 2016 7:28 pm

Hey all,
As the title says "How do I add 1 Value per 1,000,000 Points".. I've been having this issue for a few hours now and I can't seem to figure it out.. How can I give the user a "super coin" per 1,000,000 coins they have collected/accumulated? Would be great to get a good answer, I've searched and searched and found nothing.

B
14
S
1
Posts: 65
Reputation: 732

### » Sat Jul 23, 2016 7:53 pm

@EdwardJT92

Use % (modulus operator).

If PointsValue is equal or greater than 1000000 => set SuperCoinValue to SuperCoinValue+floor(PointsValue/1000000); set PointsValue to PointsValue%1000000

If you did not know, % calculates the remainder of a number divided by another:
5 % 4 = 1 4%4 = 0
B
17
S
9
G
5
Posts: 74
Reputation: 4,145

### » Sat Jul 23, 2016 7:54 pm

Safe the coints in a globale variable
If the number of coints changed check if the coints over 1.000.000
Give the gamer the super coin
Last edited by BillAlex on Tue Jul 26, 2016 12:36 pm, edited 1 time in total.
B
5
S
1
Posts: 24
Reputation: 423

### » Sat Jul 23, 2016 10:01 pm

You both helped a lot. I made that when a new variable hits 1,000,000 or so 1 gets added to another variable and get's then gets reset to 0.

So thanks both.
B
14
S
1
Posts: 65
Reputation: 732

### » Sun Jul 24, 2016 1:02 am

Or you could just set that new variable to:
Supercoins = floor(coins/1000000)
B
44
S
18
G
17
Posts: 2,249
Reputation: 17,585