Unlike FlxTileblock
, FlxTilemap
requires a defined map to be passed to it, which it uses to draw tiles from.
tilemap.loadMapFromCSV('path/to/map.csv', 'path/to/tiles.png');
Unlike FlxTileblock
, FlxTilemap
requires a defined map to be passed to it, which it uses to draw tiles from.
tilemap.loadMapFromCSV('path/to/map.csv', 'path/to/tiles.png');
package;
import flixel.FlxG;
import flixel.FlxState;
import flixel.tile.FlxTilemap;
class PlayState extends FlxState
{
override function create()
{
super.create();
var map = new FlxTilemap();
map.loadMapFromCSV("assets/map.csv", "assets/tiles.png");
map.screenCenter();
add(map);
}
}
2,2,2,2,0,0,0,0,0,3,3,3,3
2,2,2,2,2,0,0,0,3,3,3,3,3
2,2,2,2,2,2,1,3,3,3,3,3,3
2,2,2,2,2,1,1,1,3,3,3,3,3
0,2,2,2,1,1,1,1,1,3,3,3,0
0,0,2,1,1,1,1,1,1,1,3,0,0
0,0,1,1,1,1,1,1,1,1,1,0,0
0,0,4,1,1,1,1,1,1,1,5,0,0
0,4,4,4,1,1,1,1,1,5,5,5,0
4,4,4,4,4,1,1,1,5,5,5,5,5
4,4,4,4,4,4,1,5,5,5,5,5,5
4,4,4,4,4,0,0,0,5,5,5,5,5
4,4,4,4,0,0,0,0,0,5,5,5,5