Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have an existing Sprite Atlas with its data file in JSON format. How do I convert it for use with Cocos 2D and other frameworks ?

I tried poking around in Texture Packer which supports publishing to multiple formats. But I can't figure out how to convert from one format to another

EDIT : Is there any other software that is able to convert between different formats ?

share|improve this question

1 Answer

Texture Packer won't convert it's exported data from one format to another. To export in different formats you need to have the Texture Packer (tps) file used to create your JSON atlas.

If you have the tps file, just select the exporter you need from the "Data Format" drop down list in the left-hand pane. The TP home page has a graphic that explains the process succinctly.

If you don't have the tps file you have two options:

  1. Write a script to parse the JSON format you have into the Cocos 2D format you need.
  2. Recreate the tps file so you can easily export whatever format you may need in the future. This assumes you have the source sprites that are packed into your atlas.
share|improve this answer
regarding of your first paragraph, note that he has the JSON atlas, he want to convert it to cocos2d format (aka. TP defautl export format) – Ali.S Aug 14 at 17:53
@Ali.S Right, AFAIK TP does not convert JSON to Cocos2D, it exports tps to JSON or Cocos2D or any other supported format. – NoobsArePeople2 Aug 14 at 18:02
Is there any other software that does do a conversion ? Seems like something that should already be out there – user34183 Aug 15 at 1:57
1  
@user34183 Yeah, it's called Texture Packer, you set it up and export to whatever format you want ;) If you can't do that it looks like the Cocos2D format is a plist (which is just an xml document) On OSX it looks like there is a util for converting JSON to plist though there probably isn't a straight one-to-one conversion from your JSON file to Cocos2D. Converting from JSON to plist should be an easy script to write. – NoobsArePeople2 Aug 15 at 3:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.