How do I avoid having decimals shown as text?

0 favourites
  • 6 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • So i got this variable "Humidity" (im developing a sim game like sim earth..), the problem is, it is a huge number all the time after the ",", like: 45,0193458439672946

    I want to let the player track it, but i don't want him to se the ,0193458439672946. How can i do that?

  • there are a few ways eg floor(number) int(number) round(number)

    see https://www.scirra.com/manual/126/system-expressions

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, it was really easy, shame on me!

  • I got another question about performance: should i add round( to the actual number (ex, when humidity is calculated) or only to the counter that displays the number in the UI? will any of them affect performance is some way?

  • I got another question about performance: should i add round( to the actual number (ex, when humidity is calculated) or only to the counter that displays the number in the UI? will any of them affect performance is some way?

    It shouldn't matter at the end I think, do what is the more convenient for you

  • I got another question about performance: should i add round( to the actual number (ex, when humidity is calculated) or only to the counter that displays the number in the UI? will any of them affect performance is some way?

    It also depends on when and where you are doing the conversion, if you are using humidity in any other calculations (where the decimal points would make a difference), how often you are updating the UI ( hopefully you are only updating thing when they change and NOT every tick...). Converting to it once will only take a tiny amount of time - what you don't want to be doing is converting the same number over and over.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)