Limiting the amount of decimal digits on value

For questions about using Classic.

Post » Thu Jul 28, 2011 12:43 am

So... I've been trying to program a Sonic the Hedgehog style 360 momentum physics engine... As you may or may not know, this involves quite a bit of complex math equations and trigonometry...

Anyway, what i'm trying to do is limit the amount of decimal digits on a certain value (For instance, if the value is 1.4039034523; It becomes 1.404 instead) But as far as i know, construct's "Round" function rounds the number up to... Well, a round number... So how do i do this?
B
2
G
2
Posts: 19
Reputation: 688

Post » Thu Jul 28, 2011 1:22 am


FormatDecimal(number, N)
Returns a string with number given to N decimal places, eg. FormatDecimal(5.7777, 2) gives 5.78

-Construct wiki

Dont' forget to convert string back to float!
B
2
S
2
G
2
Posts: 158
Reputation: 1,366

Post » Thu Jul 28, 2011 2:15 am

Great! Works perfect, thanks!
B
2
G
2
Posts: 19
Reputation: 688

Post » Thu May 23, 2013 11:44 am

hi,

Can you show me what is FormatDecimal function?

thanks.
B
23
S
6
G
3
Posts: 39
Reputation: 4,739


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests