I'm trying to load a tilemap for a tower defense game I'm working on. I am using loadTilemapfromCSV(), with this line of code:
_map.loadMapFromCSV("assets/tilemaps/play_tilemap.csv", "assets/tilemaps/GraveyardTDTileset3Image.png", Reg.TILE_SIZE, Reg.TILE_SIZE);
(Reg.TILE_SIZE is my tile size, currently 8.) The csv file loads fine, but when I try to load the tilemap I get errors. (I was previously using some code from the MinimalistTD example to generate my tileset.) The csv is mostly 1s, with some 0s representing the path, and some 2s representing special tiles.
The tile size is 8 by 8. This is built into the code, and when I try to change it the game crashes. So I tried using the 8 by 8 tileset below:
But this caused errors. It filled in the 1s with the second tile, the tombstone. It filled in the 2s with seemingly nothing, and the game crashed when I tried to spawn my first enemy (set to follow a path). When I removed the 2s the game ran without crashing. Also, the game ran just fine when I ran it with this (16 by 16) tileset:
But it only drew the top left quarter of the tombstone.
Can anyone please tell me how to get my tilemap working correctly? I have been trying for hours and I can't figure it out at all. Thanks.