FlxTilemap
is a very handy implementation of a tilemap in the HaxeFlixel library. Currently I have working code taking maps generated with the Ogmo map editor and loaded with FlxOgmoLoader
(also from the HaxeFlixel library) into a FlxTilemap
. I would like to have a world composed of multiple tile maps that are seamlessly displayed as the player moves.
It seems this is not supported by the library. Could someone provide ideas or references on how to implement this efficiently?
While it's not perfect, you could design your tilemaps in a way they connect with each other, and keep loading them (filtering as you need) while the player moves, like
if (player.x > currentTilemap.width) {
tilemapGroup.add(new FlxTilemap(currentTilemap.x + currentTilemap.width, currentTilemap.y);
}
Also, to keep it from running out of memory, use isOnScreen()
to make the tilemaps invisible and deactived if they aren't on camera.