Snap to position?

Blitz3D Forums/Blitz3D Beginners Area/Snap to position?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

4.0 * Int( x / 4.0 ) is x rounded to a multiple of 4.

The idea is that Int() rounds to integer, i.e. a multiple of 1.

So you scale x down so the gap is 1, round it, then scale back up to multiple of 4.