I have a game, breakout clone. It has a Block class that contains CCSprite as a property. Usually I made levels by manually setting those blocks to positions. Here comes the question, how do I use generic level editors with my custom code? All editors work with CCSprites and not my class. How can I overcome that?

  • 1
    \$\begingroup\$ Either, you write a cutom exporter for the level editor of your choice, or you write an importer for your program which reads the level generated with the level editor and parses it into the format you need. \$\endgroup\$ – Exilyth Aug 4 '12 at 17:31
  • \$\begingroup\$ ^ Importer is far easier. \$\endgroup\$ – Phill.Zitt Aug 4 '12 at 22:01

As sarahm said in a comment, you need to either import the maps from files saved by the level editor or write an exporter for it(if it supports plugins/extensions like this).

Since they're generic and as such meant to be used by more than just one game, the format is probably quite simple(and almost certainly documented somewhere, just search a bit) so writing an importer is most likely the better choice.

You will probably need to read type/position/any other properties you're interested in and use them to build your map(place objects, set tile types, etc.). You could always also convert said level files to your own format, but I doubt there is much reason to do this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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