In this, I'm testing if an int
value is a whole number or has a decimal value, if it has a decimal, it slowly adds or subtracts to the value to make it a whole number. The first and the third parts work, but the second and fourth don't.
if(ax % tileSize != 0) {
ax -= (ax % tileSize) / 6; // works fine
}
if(ax % tileSize != 0) {
ax += (ax % tileSize) / 6; // doesn't work
}
if(ay % tileSize != 0) {
ay -= (ay % tileSize) / 6; // works fine
}
if(ay % tileSize != 0) {
ay += (ay % tileSize) / 6; // doesn't work
}
The ones that work are decreased by 48 / 6
each time, and the others should be increased by
48 / 6
, but it seems that the amount they are increased by changes each time.