How do I create multiple tilemap layouts with one texture?

Get help using Construct 2

Post » Mon Feb 02, 2015 12:13 am

Hi, I'm trying to make several tilemap layouts that could share the same tileset, but for every tilemap in the project there's also a unique texture, even if the tilemaps share the same original source image. Can someone suggest a workaround for this problem?

My thought was to save off layouts as some XML or JSON format and load them as-needed, but I'm not sure how to do that. A workflow like this:

Create tilemap in Construct to serve as a tileset.
Create layouts using that tileset in Tiled editor and export as XML or JSON format that Construct can load (or TMX if that works - I don't care what format).
At runtime, spawn tilemaps and size/populate them using the previously-exported Tiled data.

Alternatively I wouldn't mind creating the tilemap variations in Construct's tilemap editor. These layouts aren't that complicated but there are many of them and they will need to be created dynamically, repeatedly.

Any suggestions would be great, thanks all.
B
40
S
13
G
2
Posts: 47
Reputation: 4,173

Post » Mon Feb 02, 2015 2:22 am

Put them all on the same tile map....Count the images for each set

Then when you are drawing the map you just add thenumbers of the tiles of the tileset * The desired tileset number then you do your draw commands.

TilenumberToDraw=DesiredTileNumber+(number of tiles to next set*1)

*1 will draw from the first tileset, *2 will draw from the second... Etc...

Put all of the shared tiles at the very top, so you can add as many tilesets as you want, without moving them every time.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Mon Feb 02, 2015 2:29 am

Bye the way, you can use the WebGL Set color, and Set HSV to adjust the colors of sprites, layers, backgrounds....

So if you are just doing the exact same shapes, but changing the color each level, you might want to use the effects instead of making a huge download.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Mon Feb 02, 2015 5:28 am

Thanks jojoe, that's the nudge I needed!

I wrote a function that takes parameters for where a given sub-tilemap is on the giant tilemap, and copies the tiles from that spot to the upper-left corner of a tilemap instance, and then resizes the tilemap instance to the size of the sub-tilemap. It functions just like I need it to.

It's not ideal, workflow-wise - I would prefer that Construct tilemaps could share tileset textures (the way Tiled is set up.) But this seems like a good workaround.

As for the WebGL suggestion, I could get some interesting variety out of that technique too. Thanks again for sharing your ideas!
B
40
S
13
G
2
Posts: 47
Reputation: 4,173


Return to How do I....?

Who is online

Users browsing this forum: ditocruz and 17 guests