snap to grid question ?
Posted: Sun Nov 03, 2013 2:08 pm
how could someone code a function to force an object travelling to obey the edit time grid of squares ??
is it possible ?
is it possible ?
int lockToGrid(int val, int delimiter)
{
return round(val/delimiter)*delimiter;
} // This function will return the nearest multiple of the delimiter to your value.
x = lockToGrid(x, 10); // The current actors X value will now round to the nearest 10th pixel.