Erel B4X founder Staff member Licensed User Longtime User Jul 26, 2018 #1 First version of X2TileMap is attached. It allows loading map files created with Tiled Map Editor: https://www.mapeditor.org/ Tiled is a popular game editor. For now only the basic features are supported. X2TileMap can load maps with tile layers and draw them. Drawing is done automatically by calling DrawScreen or if you need more control you can call Draw and pass the required area. The performance is very good. Format - Maps and tilesets should be saved as json files. Note that you can edit json files directly with Tiled. - The data should be compressed and encoded as Base64 string. This is the default option. - Tilesets must be loaded from spritesheets (not collection of images). - It supports tile flipping and rotation, however the tiles images must be the same size as the map tiles. An example is attached. The video above is from the B4i example which shares the same code as the B4A and B4J examples. Example projects included in the examples pack: https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/ Last edited: Aug 23, 2018
First version of X2TileMap is attached. It allows loading map files created with Tiled Map Editor: https://www.mapeditor.org/ Tiled is a popular game editor. For now only the basic features are supported. X2TileMap can load maps with tile layers and draw them. Drawing is done automatically by calling DrawScreen or if you need more control you can call Draw and pass the required area. The performance is very good. Format - Maps and tilesets should be saved as json files. Note that you can edit json files directly with Tiled. - The data should be compressed and encoded as Base64 string. This is the default option. - Tilesets must be loaded from spritesheets (not collection of images). - It supports tile flipping and rotation, however the tiles images must be the same size as the map tiles. An example is attached. The video above is from the B4i example which shares the same code as the B4A and B4J examples. Example projects included in the examples pack: https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/
Jeffrey Cameron Well-Known Member Licensed User Longtime User Jul 26, 2018 #2 Well done! If you keep making this any easier and I just may have to revisit my shelved adventure game
Well done! If you keep making this any easier and I just may have to revisit my shelved adventure game
Jeffrey Cameron Well-Known Member Licensed User Longtime User Jul 27, 2018 #4 Have you done any testing to see how big (squares wide by high I mean) the maps can be (on average) before there starts to be memory or performance issues?
Have you done any testing to see how big (squares wide by high I mean) the maps can be (on average) before there starts to be memory or performance issues?
Erel B4X founder Staff member Licensed User Longtime User Jul 29, 2018 #5 The map size shouldn't really matter. X2TileMap only draws the currently visible tiles. In this specific example the minimap does draw the complete map. If the map is very large then it might be better to load it from a bitmap. However this is not the usual case.
The map size shouldn't really matter. X2TileMap only draws the currently visible tiles. In this specific example the minimap does draw the complete map. If the map is very large then it might be better to load it from a bitmap. However this is not the usual case.
Erel B4X founder Staff member Licensed User Longtime User Aug 13, 2018 #6 Examples were updated with latest version of X2 framework. Note that there is a file named objecttypes.json in the Files tab. This is a new file that is required when using X2TileMap. It holds the objects custom properties defaults. You can import it to Tiled with: View - Objects Type Editor File - Import
Examples were updated with latest version of X2 framework. Note that there is a file named objecttypes.json in the Files tab. This is a new file that is required when using X2TileMap. It holds the objects custom properties defaults. You can import it to Tiled with: View - Objects Type Editor File - Import
Erel B4X founder Staff member Licensed User Longtime User Aug 16, 2018 #7 Updated the projects with the latest version of objecttypes.json, the file containing the default custom properties.
Updated the projects with the latest version of objecttypes.json, the file containing the default custom properties.
Computersmith64 Well-Known Member Licensed User Longtime User Sep 27, 2018 #8 I don't understand how to use the x2 object type. I've created a new map (using a "roads" tileset that I have) & imported the x2 Object Type, but I can't figure out how to associate it with the map. When I look at the map that came with the example (map1.json) it shows an object layer (ObjectLayer1) with a sub-layer (x2) - but I can't seem to get that in my map. - Colin.
I don't understand how to use the x2 object type. I've created a new map (using a "roads" tileset that I have) & imported the x2 Object Type, but I can't figure out how to associate it with the map. When I look at the map that came with the example (map1.json) it shows an object layer (ObjectLayer1) with a sub-layer (x2) - but I can't seem to get that in my map. - Colin.
Erel B4X founder Staff member Licensed User Longtime User Sep 27, 2018 #9 Please start a new thread for your question (in the games forum).