Single Layout, Multiple Levels. Help w/Tilemaps

Get help using Construct 2

Post » Sat Jan 28, 2017 9:48 pm

Hey guys. I'm creating a simple platformer and I figured, memory-wise using a single layout with multiple instances of the same tilemap might be the best solution for different levels. Is this a correct assumption?

How do I save the tilemap configurations into an array and load them to the appropriate levels in the game?

I'd appreciate it if someone could edit this capx. 8-)
https://www.dropbox.com/s/ctwcooln67707 ... .capx?dl=0

Haven't done much in the capx yet.
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Mon Jan 30, 2017 12:25 pm

You can save a tile map configuration using the tilemap's 'TilesJSON' expression. You can store it as a string - if I need multiple tilemaps for multiple levels I'll usually use a Dictionary with keys named for each level, and the value set to the TilesJSON for that level.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 237
Reputation: 2,296

Post » Mon Jan 30, 2017 12:55 pm

mrtumbles wrote:You can save a tile map configuration using the tilemap's 'TilesJSON' expression. You can store it as a string - if I need multiple tilemaps for multiple levels I'll usually use a Dictionary with keys named for each level, and the value set to the TilesJSON for that level.


Can you show example too of how to repopulate the map after?
I made different instances of the tilemap but how do I use only one?
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Tue Jan 31, 2017 5:09 pm

mrtumbles wrote:You can save a tile map configuration using the tilemap's 'TilesJSON' expression. You can store it as a string - if I need multiple tilemaps for multiple levels I'll usually use a Dictionary with keys named for each level, and the value set to the TilesJSON for that level.


I found the download as json action but now how do I save multiple levels?
I'm thinking have all maps in my MAIN MENU layout, save all tilemaps as json then delete all. So the next time a user starts the game the tilemaps will be deleted and accessed from webstorage.
Is this the correct usage? Could someone modify the capx?
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Wed Feb 01, 2017 6:59 pm

Personally I would create the tilemaps in C2, grab their JSONs one by one, then store them in a dictionary.json which you include as a project file and load on start - rather than writing events to populate the dictionary, which I think would mean you'd have to loop through the levels on start.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 237
Reputation: 2,296

Post » Wed Feb 01, 2017 7:22 pm

mrtumbles wrote:Personally I would create the tilemaps in C2, grab their JSONs one by one, then store them in a dictionary.json which you include as a project file and load on start - rather than writing events to populate the dictionary, which I think would mean you'd have to loop through the levels on start.


Yes that's exactly what I mean't. Sorry my games haven't really been as complex to require the use of the dictionary that's why I'm confused.
Using this dictionary, will it be saved locally when I export this game to Android/iOS or will users be required to download all info from a cloud?
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Thu Feb 02, 2017 5:47 pm

If the JSON is stored as a project file and loaded on start, the file will be saved locally, yes.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 237
Reputation: 2,296


Return to How do I....?

Who is online

Users browsing this forum: Apollo14, ivanski1983, KTML5 and 4 guests