2D Toolkit Forum

2D Toolkit => Support => Topic started by: brettjohnson on August 15, 2014, 03:48:27 pm

Title: Advice on randomizing world using multiple tilemaps
Post by: brettjohnson on August 15, 2014, 03:48:27 pm
Hi, I'm working on a top down game where I'd like the world to be randomized each time you play. My plan:

1. Build each location, a house for example, as single tilemap prefab.
2. Have a large world tilemap that acts as the ground.
3. Randomly place each location tilemap. (For this I have a couple of ideas)
- option 1. Have another tilemap, equal in width and height to the world tilemap, but with tile size equal to the size of a location prefab tilmap. Each prefab would be placed as prefab tile.
- option 2. Instantiate and align each location tilemap in an appropriate position. (This option sounds like the better one, but wanted to make sure.)
4. Somehow merge the tiles from the location tilemaps into the world tilemap as layers. (Is this possible/useful/worthwhile?)

So what are your thoughts? Am I going about this in a good way?

Thanks
Title: Re: Advice on randomizing world using multiple tilemaps
Post by: unikronsoftware on August 16, 2014, 12:32:56 pm
Hmm... If you're gonna do this from code, you should look into the API (http://2dtoolkit.com/docs/latest/html/classtk2d_tile_map.html). You can set and get tiles, and I recommend managing everything yourself. I wouldn't then use multiple layers unless you actually need them.