If you’re going to have a lot of tiles, having a tile instance for each position will be memory heavy. You can use LiquidNitrogen’s texture set implementation, but you can get the “frame” based on the X and Y position.
Small example:
public static int variantNum(long magic, int x, int y) {
return ((int) ((magic + (x + 17) * (y + 53) * 214013L + 2531011L) >> 16) & 0x7fff);
}
That returns a “variant number” based on the X and Y. The magic long number should be generated once on world-load.
In order to use it, you bitwise-AND it by the number of different textures you have minus one. One exception is the number of types MUST BE a power of 2 number.
Example:
world.batch.draw(world.main.manager.get(sprites.get("defaulttex"
+ ((variantNum(world, x, y)) & (varianttypes - 1))), Texture.class), x
* world.tilesizex - world.camera.camerax + offx, Main.convertY((y
* world.tilesizey - world.camera.cameray)
+ World.tilesizey + offy));
Examples were stolen from my other game’s code: modify as you need fit.