# how do I round up to the nearest whole number?

0 favourites
• 10 posts
From the Asset Store
Jump on numbers in the proper order and reach the sun!
• Hello everyone! I have a question, how do I round up a number to the nearest whole number

<img src="" border="0" />[/IMG]

How do I round it up to the nearest whole number like 6999? Thanks in advance! <img src="smileys/smiley4.gif" border="0" align="middle" /> (My first post)

• ceil(x)

• "round(x)" also seems to work fine.

Update.

Apparently i can't read very well. >_>

I tend to accidentally a couple of words every now and then...

My most sincere apologies, gentlemen.

• Stiivais The OP was asking for rounding up. Yes round(x) would work, but if the decimal is below 5 it will round down. ceil(x) will always round up, and floor(x) will always round down.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Because topicstarter was asking for rounding up, ceil() is the right answer.

for rounding up one uses : ceil()

for rounding down one uses : floor()

for rounding up or down one uses : round()

• Thanks everyone for your replies, but I still don't get it.

Here's my code: distance(Slingshot.X, Slingshot.Y, snail.X, snail.Y)

I'am trying to make it display the distance between the catapult and the snail, but I don't have any idea where to insert the formula like the ceil(), floor() ect. Thanks!

• ceil(distance(Slingshot.X, Slingshot.Y, snail.X, snail.Y))

• Got it! Thanks everyone! <img src="smileys/smiley4.gif" border="0" align="middle" />

• One more question: do I create a elastic band that connect the slingshot to the snail?

• 10 posts