Games [XUI2D] X2TileMap - Tiled maps

Erel

B4X founder
Staff member
Licensed User
Longtime User
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:

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
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
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
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
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.
 
Top