Skip to content

Instantly share code, notes, and snippets.

@lionelB
Created February 3, 2011 09:19
Show Gist options
  • Save lionelB/809252 to your computer and use it in GitHub Desktop.
Save lionelB/809252 to your computer and use it in GitHub Desktop.
useful little snippets
/*
Find the number of complete row and col from a number of objects
*/
col = Math.sqrt(_nbCards);
if (_nbCards % col > 0)
{
while (_nbCards % ++col != 0){};
}
row = _nbCards / col;
if (row > col)
{
// A screen is wider than tall :)
var t:int = col;
col = row;
row = t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment