Isometric Tilemap

Hey guys, I’m new to openFL and was amazed by the great performance the new Tilemap api has. I’ve gone through this tutorial: http://haxecoder.com/post.php?id=25 for placing tiles, and managed to make an isometric map by shifting the position of the tile before drawing. Is it possible to do this with the new Tilemap api? I’m not finding a whole lot of information on the subject, is it as simple as calling tilemap instead of tilesheet.drawTiles or is the API different in some way?

1 Like

The Tilemap is not complete (yet), I took the first step in sketching out the API, and began asking if the direction of the API seemed sound, and seemed to cover the use-cases people needed. I think we probably have the confirmation we need, and should finish it up. You’ll have to wait (at the moment) but I hope to see it finished in the next couple months

Oh I see, thats unfortunate. Welp heres my use case anyways, attempting to get the tile-demo to use Tilemap while being drawn isometrically. I dont understand most of whats going on though.

// Tilesheet initialization
	var tilesBitmapData:BitmapData = Assets.getBitmapData("img/tiles2.png");
	tileset = new Tileset (tilesBitmapData);
	tileset.addRect(new Rectangle(0, 0, 64, 32));
	tileset.addRect(new Rectangle(64, 0, 64, 32));


	var tilemap = new Tilemap (stage.stageWidth, stage.stageHeight);
	var layer = new TilemapLayer (tileset);

	// Map data
	tileSize = 32;
	map = new Array<Array<Int>>();
	TileMap.create(map);

	// Game loop
	stage.addEventListener(Event.ENTER_FRAME, everyFrame);
}

private function everyFrame(evt:Event):Void {
	var tileData:Array<Float> = [];
	for (row in 0...map.length) {
		for (cell in 0...map[row].length) {
		 	xpos = row*32 + cell*32;
			ypos =  row*16 - cell*16;
			layer.addTile (new Tile (map[row][cell],xpos,ypos));
		}
	}
	tilemap.addLayer (layer);
	addChild (tilemap);
}

maybe it helps you to have a look at this project: https://github.com/matthewswallace/openfl-tilelayer
Not sure if it still works with the current openfl version, but still it could help you looking at the code.