Hi

I haven't found this anywhere so:

How to do condition that repeats itself for every let's just say 10 points. I know there are many examples with time, but none with something other then time.

17 posts
• Page **1** of **2** • **1**, 2

**Posts:**1,520**Reputation:**25,305

B

55
S

28
G

18
% here is the mathematical modulus.

It makes it so that the value compared is between 0 and 9 in that case (when points = 10 it is actually equal to 0).

If points=20, it cycle "two times".

It's not a very good/precise explanation but the idea is that it cycles through this range according to the original value.

It makes it so that the value compared is between 0 and 9 in that case (when points = 10 it is actually equal to 0).

If points=20, it cycle "two times".

It's not a very good/precise explanation but the idea is that it cycles through this range according to the original value.

**Posts:**7,210**Reputation:**73,086

Moderator

B

267
S

95
G

66
To expand on what Kyatric said: points % 10 gives you the remainder when points is divided by 10. So for example, if points = 100 then points % 10 = 0 (100/10 = 10 remainder 0). If points = 101, points % 10 = 1 (101/10 = 10 remainder 1).

Basically, checking if a number % 10 = 0 tells you if the number is evenly divisible by 10. If you wanted something to happen when points = 6,12,18,24,etc you'd check if points % 6 = 0.ramones 2012-08-21 11:52:12

Basically, checking if a number % 10 = 0 tells you if the number is evenly divisible by 10. If you wanted something to happen when points = 6,12,18,24,etc you'd check if points % 6 = 0.

**Posts:**1,520**Reputation:**25,305

B

55
S

28
G

18
I want to thank everyone for Your quick answers and good explantations of modulus. Now i'm begining to understand how modulus works, but can I use it to accelerate falling elements in my game. I want my elements for every 100 points to accelerate so that with every 100 points they would fall down faster and faster.sled 2012-08-23 13:32:21

**Posts:**17**Reputation:**334

B

4
UPDATE:

Maybe i didn't explain clear enough. I'm making a game where blocks are falling from top to bottom and players catches them, but that is not important. I want those block to accelerate to fall faster with every 100 points but i don't know how to do this. I've got my own movement system if someone wants to know.

First I made my variable like this:

- "Falling Block" with variable "speed" that is a number and have value of 0.

I'm setting my variable in "on start of layout" to

Sprite11 -> Set speed to Sprite11.Y+1

and then

System -> Points %5=0 -> Sprite11 ->Set speed to Sprite11.speed+5

Trigger Once

but when Points passes 5,10...and so one blocks are not accelerating.

Maybe i didn't explain clear enough. I'm making a game where blocks are falling from top to bottom and players catches them, but that is not important. I want those block to accelerate to fall faster with every 100 points but i don't know how to do this. I've got my own movement system if someone wants to know.

First I made my variable like this:

- "Falling Block" with variable "speed" that is a number and have value of 0.

I'm setting my variable in "on start of layout" to

Sprite11 -> Set speed to Sprite11.Y+1

and then

System -> Points %5=0 -> Sprite11 ->Set speed to Sprite11.speed+5

Trigger Once

but when Points passes 5,10...and so one blocks are not accelerating.

**Posts:**17**Reputation:**334

B

4
17 posts
• Page **1** of **2** • **1**, 2

## Who is online |

Users browsing this forum: jdevone and 11 guests |