How do I design my levels in a text format

Get help using Construct 2

Post » Sat Feb 07, 2015 6:37 am

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.
B
10
S
4
G
5
Posts: 139
Reputation: 2,983

Post » Sat Feb 07, 2015 7:26 am

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.
B
36
S
9
G
1
Posts: 208
Reputation: 3,319

Post » Sat Feb 07, 2015 3:13 pm

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.
B
28
S
8
G
4
Posts: 767
Reputation: 5,950

Post » Sat Feb 07, 2015 7:05 pm

Interesting, I'll check it all out.

Thanks corlenbelspar and jojoe.
B
10
S
4
G
5
Posts: 139
Reputation: 2,983


Return to How do I....?

Who is online

Users browsing this forum: Burgrokash, Carlafnt, Flipy, MatheusCastellar, Taser and 8 guests