• News

• Industries

• Learning & Support

• Community

• Marketplace # Measuring player z axis problem

Hi guys this might be simple but been struggling all night trying to solve it .
Basically in the game the player can jump and get higher and higher therefore increasing his z axis .
We are using the players z axis to determine the players score .

So the higher the player jumps the higher his score goes . The z axis is in a float so we convert it to an Integer and truncate to get whole number . But we want this to be in multiples of 100 .

So for example I start at 0 on the z axis . I jump once and land on the platform . I am now at let’s say 150 on the z axis . So therefore my score would be converted to 1 (remainder of 50) because we went past 100 . So now I’m at 150 I jump a second time and now I’m At 240 on the z axis my score would be 2 ( remainder 40)

So for every multiple of 100 z axis height equals 1 score .

And then also the player can fall so we need the opposite to happen so for every multiple of 100 z axis the player falls he looses 1 from the score

So for example let’s say I am at 350 on the z axis do my score
Would be 3 ( remainder 50) I then fall 200 on the z axis and am now at 150 on the z axis my score would now be 1 (remainder 50 ) as I fell 200 z axis which is equal to 2 score

If this is unclear I can try and post a video later . Thanks

Actually I think I just figured it out I was over complicating things . All I need to do is take the current distance travelled z axis and divide by 100 then truncate the value to a whole number . So if current z axis is 200 . Score would be 200/100 = 2 . I then fall 100 on the z axis so current z axis is now 100 so score would be 100/100 = 1