How do I design my levels in a text format

  • Hi there,

    I'm making a game with a fairly simple level layout (two block types, a player, 2 enemy types, and an exit).

    I'd love to be able to just design the levels in a text format using arrays, rather than having to use the Construct 2 editor and a ton of Layouts. Similar to the way Derek Yu made levels for Spelunky if you've seen the Indie Game the Movie extra scenes.

    I know the basics of using arrays and could probably figure out how to pull the data from an array to put all the bits in the right places.

    The thing I don't know is how to use an external text file to create the arrays in the first place, and import that data into Construct.

    The Arrays for Beginners tutorial talks about saving JSON files, but it seems like that's more for once you have your game uploaded to the web, rather than just for the actual local development. Maybe I'm wrong??

    Any help is greatly appreciated.

  • I guess you could make advanced use of the left() and right() expressions calculated depending on the mouse position in your editor and then load it accordingly. But I'd say the best approach would be to use tilemaps and tiled.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Check out the TokenAt, and count token expression.

    You do not need to stick to json format, you can make your own, just surround your data in "Tokens" like this:

    [name]Joey[name]

    [name]Frank[name]

    [name]Tommie[name]

    [name]Sam[name]

    I found it much easier to just unload the array data into my own format. First off it is much more human readable if you want it to be. I found this to be especially true when dealing with Tile sheets.

  • Interesting, I'll check it all out.

    Thanks corlenbelspar and jojoe.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)