Modulo is the remainder of the quotient when dividing. For example, in 5/2, the remainder is 1. Modulo is represented like this:
The modulo would be 1, in this case. 5%3 would be 2, 5%4 would be 1, and so on.
Modulo can be used to increase a variable at a certain time or have only even or odd numbers. It can also be used to have an object do certain things when variable are at a particular range.
Let's make a game. In this game, the player will dodge obstacles. For every three obstacles the player bumps into, the score will go down. (I will include screenshots of this later)
This game can be somewhat like subway surfers. In the character's code, add in this:
When (self) bumps (train[this can be whatever you like])
increase variable (Number of times bumped) by 1
This is not the main score, but it is a factor for what the score may be. For the next code, we add in modulo.
When [(Number of times bumped) % 3] = 0
Increase variable (Score) by -1
So now, every 3 times the character bumps the train, the score will go down by 1. If you want to, you can make it that the player will lose a life every 3 times it bumps into something. You can increase the variable if you wish.
If needed, I shall provide screen shots later.