Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Beeblerox/e5ac1530bf1da41f1e28885ba727c560 to your computer and use it in GitHub Desktop.
Save Beeblerox/e5ac1530bf1da41f1e28885ba727c560 to your computer and use it in GitHub Desktop.
var tileWidth:Int = 32;
var tileHeight:Int = 32;
var tileSize:FlxPoint = new FlxPoint(tileWidth, tileHeight);
var tileSpacing:FlxPoint = new FlxPoint(2, 2); // we need to add spacing between tile images
var tileBorder:FlxPoint = new FlxPoint(2, 2); // and add borders around tiles (copy some pixels around tile images)
var tileFrames:FlxTileFrames = FlxTileFrames.fromBitmapAddSpacesAndBorders("your/tileset/image", tileSize, tileSpacing, tileBorder); // this method just takes original image, creates new one and generates required collection of frames, which can be loaded in tilemap or sprite
tilemap.loadMapFromCSV(mapData, tileFrames); // all tilemap loading methods can take tile frames collection as a source of graphics for them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment