# Multiples of particular number/value

Just started using Construct 2? Post your questions here

### » Thu Oct 09, 2014 11:20 am

Hi!

How do I check if a value (say of a global variable) is a multiple of a particular number?

For example, I'd like after every 5 turns for the game to give the player extra lives etc.

I'm thinking : compare if the global variable divided by 5 is equal to an integer, then add 1 life. But how do I write this as an expression?

Thanks for any suggestions!
B
10
S
3
Posts: 15
Reputation: 1,191

### » Thu Oct 09, 2014 11:27 am

Create a global variable called Turns
At the end of each turn add 1
Compare global Variable Turns = 5 then add 1 life, and set global variable to 0
You think you can do these things, but you can't, Nemo!
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,743

### » Thu Oct 09, 2014 4:47 pm

Thank you so much- I love the simplicity of your solution!
B
10
S
3
Posts: 15
Reputation: 1,191

### » Thu Oct 09, 2014 7:34 pm

Simple is always better
You think you can do these things, but you can't, Nemo!
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,743

### » Thu Oct 09, 2014 9:18 pm

if turns % 5 = 0
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

### Who is online

Users browsing this forum: No registered users and 5 guests