How do I ... round positions after "0.xxx"?

Get help using Construct 2

Post » Wed Nov 25, 2015 9:26 am

Hello and first as always, sorry for my english ;)

How do I calculate the number of positions after the "." (I non't know how i should epxlain it better)?

When I calculate a number and the result for example is "1.123456789" - what can I do to only show/calculate only a number like "1.12"?

Thanks for your help!
B
22
S
6
G
2
Posts: 185
Reputation: 3,632

Post » Wed Nov 25, 2015 9:40 am

Something like: round(your_number*100) / 100 should do the trick (make sure you get your brackets in the right place). Times it by 10 if you want more than 2 decimal places (so, to make 1.23456 into 1.234, switch 100 in the above formula for 1000).
Image
B
12
S
4
G
1
Posts: 30
Reputation: 946

Post » Wed Nov 25, 2015 10:24 am

Nice splained.
Voulk
B
32
S
9
G
3
Posts: 280
Reputation: 4,262

Post » Wed Nov 25, 2015 6:49 pm

Thanks, Voulk!
B
22
S
6
G
2
Posts: 185
Reputation: 3,632


Return to How do I....?

Who is online

Users browsing this forum: DolyGamesCosmos, Yahoo [Bot] and 22 guests