Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
How do you use the "round" command?
The 'round' expression? It just rounds a floating point number to the nearest whole number. Eg. round(0.7) = 1, round(6.3) = 6. It was missing from System Expressions on the wiki, so I added it.
oh... I thought it could be used for grids. Like round 29 to closest 32.
You can also use it for that, to round x to the nearest multiple of 32 is something like:
round(x / 32) * 32
If the alignment is wrong try floor(x / 32) * 32.
Develop games in your browser. Powerful, performant & highly capable.
Ok thanks! Since mmf didn't use decimals i was used to do just X/32*32.
It's worth noting that division defaults to floating point calculation in Construct - you have to explicitly use Round or Int to specify integer operations (which is opposite to MMF where you explicitly specify when you want to use float operations).