Adding one variable to another

Get help using Construct 2

Post » Sun May 26, 2013 6:40 pm

Hi,

I have a variable that acts as a counter, and a variable that acts as a score. The counter runs continuously, and I wanted it to add 1 to the score variable after every 10 count. What would be the best way to do this.

Thanks for your help!
B
8
S
2
G
1
Posts: 63
Reputation: 880

Post » Sun May 26, 2013 7:12 pm

either use modulo %10 or add a third variable that resets back to 0 on 10.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sun May 26, 2013 7:22 pm

- If Counter % 10 == 0
- Trigger Once While True
-> Add 1 to Score

Counter % 10 will get the remainder of dividing by 10. so if its 10, 20, 30, etc. the result will be 0. Anything else will result in 1-9 and thus not being true. Also, you need the trigger once there so it doesn't do it every tick while it equals 0
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Mon May 27, 2013 8:19 am

@xeed, @EncryptedCow,

Thank you for your help, I'll give your suggestions a try :)
B
8
S
2
G
1
Posts: 63
Reputation: 880


Return to How do I....?

Who is online

Users browsing this forum: Megavolt, mnashwan, shinkan, stylie1, tarek2 and 17 guests