Using libgdx here. I've just finished learning some of the basics of creating a 2D environment and using an OrthographicCamera to view it. The tutorials I went through, however, hardcoded their tiled map in, and none made mention of how to do it any other way. By tiled map, I mean like Final Fantasy 1, where the world map is a grid of squares, each with a different texture.
So for example, I've got a 6 tile x 6 tile map, using the following code:
Array<Tile> tiles = new Array<Tile>();
tiles.add(new Tile(new Vector2(0,5), TileType.FOREST));
tiles.add(new Tile(new Vector2(1,5), TileType.FOREST));
tiles.add(new Tile(new Vector2(2,5), TileType.FOREST));
tiles.add(new Tile(new Vector2(3,5), TileType.GRASS));
tiles.add(new Tile(new Vector2(4,5), TileType.STONE));
tiles.add(new Tile(new Vector2(5,5), TileType.STONE));
//... x5 more times.
Given the random nature of the environment, for loops don't really help as I have to start and finish a loop before I was able to do enough to make it worth setting up the loop. I can see how a loop might be helpful for like tiling an ocean or something, but not in the above case.
The above code DOES get me my final desired output, however, if I were to decide I wanted to move a piece or swap two pieces out, oh boy, what a nightmare, even with just a 6x6 test piece, much less a 1000x1000 world map. There must be a better way of doing this.
Someone on some post somewhere (can't find it now, of course) said to check out MapEditor. Looks legit. The question is, if that is the answer, how can I make something in MapEditor and have the output map plug in to a variable in my code? I need the tiles as objects in my code, because for example, I determine whether or not a tile is can be passed through or collided with based on my TileTyle enum variable. Are there alternative/language "native" (i.e. not using an outside tool) methods to doing this?