How do I round a number?

Get help using Construct 2

Post » Thu Apr 10, 2014 12:32 pm

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?
B
8
S
1
Posts: 62
Reputation: 627

Post » Thu Apr 10, 2014 12:52 pm

dilk wrote: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
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Thu Apr 10, 2014 2:58 pm

Thank you, worked great! :D
B
8
S
1
Posts: 62
Reputation: 627

Post » Sat Jun 14, 2014 4:14 pm

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. :)
B
53
S
16
G
6
Posts: 718
Reputation: 9,150


Return to How do I....?

Who is online

Users browsing this forum: mikehive, Ninjadoodle, plinkie, Yahoo [Bot] and 8 guests