Another way to explain the modulus operator is like this, in a not-so-decent coding method:

Code:

function get_remainder(number, value)
{
temp = int(number/value);
return(number-value*time);
}

function another_function(parameters)
{
some_var = 160;
// ... more code above here
some_var = get_remainder(some_var, 30); // returns 10 and the same as
// some_var %= 30; // also returns 10
// ... more code below here
}



Although code like this is meaningless, this is the basic algorithm behind it - it's not all that complex either.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials