Jump to content

What.......the hell....


Recommended Posts

Posted (edited)

You're updating distPerc once, and only once, at the top of your onLoop() method. This is the root of your problem.

 

You need to update both of them in your onPaint() method.

 

 

I had them in onPaint before, same problem.

 

EDIT:

I DON'T KNOW HOW but putting it back in onPaint fixed it! thanks so much guys!

Edited by Paradox68
  • Like 1
Posted

I had them in onPaint before, same problem.

 

In the image that you posted, this is the issue.

 

distPerc was never being updated after you start the script, however you are updating currentDist in your onPaint() method. This would lead to the Distance: display on your paint showing correctly, however the percentage display is stuck at the original calculated amount at the start of the script.

 

As everyone else is saying, you also need to make sure you're casting at least one of the variables in your distPerc calculation to a double (either currentDist or startDist), so that it performs floating point multiplication. This is for accuracy purposes.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...