Jump to content
  • Advertisement

Tiled .tmx Map to Texture Atlas libGDX

Recommended Posts

I have some  tiled tmx maps I made. I have  a texture atlas that contains all of the textures I'm using in my libGDX game . I have a  json tiled map saver class  I wrote that stores the atlas region name(s) of the texture for the tiled map tile  or animated tile  as well as any  other info like  flipped, tile  color,  tile brightness,  ect.  That class  saves my tiled map  to json and loads it from json using the texture atlas to retrieve the  texture regions  .  Most of my map is procedurally generated  at run time with some parts I created in the tiled program saved in .tmx format . I need to save the entire map (both procedurally generated and the added  .tmx parts (that may have changed  since first loading). The two parts get mixed together and changed somewhat to become  one tiled map. My problem is I can't figure out how to get the atlas region name  from   the texture region that is loaded with the .tmx map or create a new atlas region. I can create a new texture atlas  with libGDX and add new  texture regions to it and give them atlas names to save the map ,   but then how do I save the newly created texture atlas  along with the  packed images at run time?

Share this post

Link to post
Share on other sites

I solved this issue!  If I use  a collection of images in tiled.   I can get the file name for each image in the properties   section of the tile in libGDX. which I can then  turn into  the atlas Region name and save it.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!