Skip to content

Instantly share code, notes, and snippets.

@slaskis
Created September 9, 2009 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaskis/183678 to your computer and use it in GitHub Desktop.
Save slaskis/183678 to your computer and use it in GitHub Desktop.
var maxTilesPerRow = Math.floor( MAX_TILE_MAP_WIDTH / _maxRect.width );
var totalTiles = 0;
for( e in _effects )
totalTiles += e.frames;
if( totalTiles < maxTilesPerRow ) {
// Simplify for few frames.
_tileMapWidth = Std.int( totalTiles * _maxRect.width );
_tileMapHeight = Std.int( _maxRect.height );
} else {
var rowsNeeded = Math.ceil( maxTilesPerRow / totalTiles );
_tileMapWidth = MAX_TILE_MAP_WIDTH;
_tileMapHeight = Std.int( rowsNeeded * _maxRect.height );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment