You're going to want to check if your experience value can be divided by 100 with a remainder of 0.

For this, there is the modulo operator %. Modulo gives you the remainder of a division.

examples:

200 % 100 = 0

301 % 100 = 1

950 % 100 = 50

therefore:

if experience % 100 = 0 then you know the experience is a multiple of 100.

**This won't work if they surpass the multiple of 100, going from 99 to 101 for example, so you'll have to do something a bit fancier like this:**

**(Warning, some math and programming shenanigans)**

It boils down to this condition, which I will attempt to explain:

**floor( currentExp / expNeededToLevel ) > floor( oldExp / expNeededToLevel ) ** -> if true, level up!

**"floor()"** rounds whatever is in parenthesis down to the nearest integer (whole number). So 0.9 would round to 0 -- and 1.1 would round to 1.

**"expNeededToLevel"** is the amount of experience needed in order to level up (in your case this is 100).

**"oldExp"** is the experience value BEFORE adding new experience.

**"currentExp"** is the experience value AFTER adding new experience.

**">"** is the "greater than" operator and checks if the value on the left of it is greater than the value on the right of it, and says true (1) or false (0) about it.

So if your character had 99 experience, then killed a bug and gained 2 experience, it would go like this:

**expNeededToLevel** = 100

**oldExp** = 99

**currentExp** = 101 (after adding 2 for the bug)

So if you remember the condition from above:

**floor( currentExp / expNeededToLevel ) > floor( oldExp / expNeededToLevel ) **

If I plug in the values you get:

floor(101 / 100) > floor(99 / 100)

which reduces to:

floor(1.01) > floor(0.99)

after floor reduces to:

1 > 0

meaning "one is greater than zero" which is a true statement, so your character needs to level up!

You can replace 100 with any number of experience you want.

I hope this helps you.