Best Practice: creating 30+ levels for 2D platformer

Get help using Construct 2

Post » Mon May 01, 2017 1:42 am

@SoldjahBoy

thanks a million for your reply. i've used dictionaries and arrays a lot before; it never occurred to me that i can do as you suggested. thanks a million for your advice.

my only question is this: suppose i create the level editor and save 30 levels in a dictionary. now, how do i save that from the level editor as a stand alone file that can be "imported" from the actual game. also, does that mean that an extra file must be distributed/installed by the user to play the entire game?

can you please explain how to get the data "out of" the level editor and "into" the game during run time and how to address the file distribution?
B
134
S
41
G
10
Posts: 133
Reputation: 13,624

Post » Mon May 01, 2017 1:52 am

No problem at all mate.

I guess there's a few ways you could go about it... if you save to a dictionary for example, and save a file from it (essentially an XML file) then you can include these files with your game and simply read from them at runtime (basically "loading" the data into your game and creating the tiles from it). If you are going with a mobile platform then honestly I'm not sure how that would work (since I think you can only access browser storage?) - I don't make anything for mobile as you can probably tell.

You could also export these XML "saves" from your editor on your computer... then create global variables in your game hat correspond to each level, and then literally copy and paste the entire save file contents into a global variable, then load THAT into a dictionary at runtime (so you can reference the various lines of data or call up whatever else you need).

If you are going to do a PC release though, then yeah... totally just include your dictionary generated "save files" and load them up at runtime.

I have made some stuff with dictionaries that combine several dictionaries into a single one... for example, Dict1 is used to save the level tiles, Dict2 is used to save the entities (player/enemies), Dict3 is used to save stats for the game (lives, score, etc), then Dict4 is used to combine Dict1,2,and 3 into a single "save file". When loading the file, it is then "unpacked" back into the 3 individual dictionaries so I can re-create the objects simply using linecount, loopindex, and a single global variable that grabs each dictionary for distribution to the object(s).

Hopefully that makes sense.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Previous

Return to How do I....?

Who is online

Users browsing this forum: Blendi1223 and 34 guests