How do I round a number?

  • Basically I have this numeber that when adding 0.001 one will go into a thousand decimals.

    I don't want to round the number itself, rather, how do I make some text I set out only show to the 0.# decimal instead of 0.########### ?

    I did set text (floor(boatStatus)) which works only it will only show whole numbers, I want the first decimal to be shown too, How would I achieve this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Basically I have this numeber that when adding 0.001 one will go into a thousand decimals.

    I don't want to round the number itself, rather, how do I make some text I set out only show to the 0.# decimal instead of 0.########### ?

    I did set text (floor(boatStatus)) which works only it will only show whole numbers, I want the first decimal to be shown too, How would I achieve this?

    I personnally use:

    Floor(boatstatus*10)/10, if you want 2 decimals, replace 10 with 100

  • Thank you, worked great!

  • Hi! I tried to create a 20 Second timer with Timer-dt but it shows 3 decimals. I tried your example with (Timer*100)/100 but its flickering the whole time.

    I used Every Tick > Set Text. Any idea how to fix this?

    /Update: It was aligned right and after aligning the text in the textobject on the left it does not flicker so much. Thanks for the example.

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