Created
February 3, 2011 09:19
-
-
Save lionelB/809252 to your computer and use it in GitHub Desktop.
useful little snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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