Hello Guest

Author Topic: Changing individual tiles at runtime  (Read 4178 times)

Ljacobs

  • Newbie
  • *
  • Posts: 2
    • View Profile
Changing individual tiles at runtime
« on: August 02, 2013, 08:29:28 pm »
Hello,

I'm using 2D Toolkit with Playmaker and it's been very useful.

I've used it so far to make  a FF style side battle system, but now I'm moving on to a roguelike.

I'm having a bit of difficulty using 2D Toolkit to make the map.

Here's the end result I'm looking for.

An array of x,y coords, where each x,y is a separate tile. The default tile is Wall.

When I generate a map procedurally I want to on a tile by tile basis swtich tiles as needed. For instance, when I create a small room, change 9 of those tiles to be changed to Floor.

I've researched the logic structures, and I'm confident on that, I'm just not clear on how to use 2D Toolkit to do this.

Any advice?

Thanks,
-Luke

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing individual tiles at runtime
« Reply #1 on: August 03, 2013, 11:09:04 am »
You can't use Playmaker to change tiles just yet. The integration just doesn't exist yet. My main concern here would be performance - doing it in an action one tile at a time would be really really slow. What were you planning on doing here?

Ljacobs

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Changing individual tiles at runtime
« Reply #2 on: August 06, 2013, 07:19:52 pm »
I'm working on a roguelike, and the hardest part has been doing the map gen in Unity :)

My aim was to generate in code an x by y grid of tiles, each of which I could treat as a ndoe for pathfinding, and the sprite of which I could change (along with flipping some variables-) and then get a lot of mileage out of each tile.

My main goal is to be able to make a roguelike, tile map so without buying something like map and nav, which is reasonably priced, but too much for me right now.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing individual tiles at runtime
« Reply #3 on: August 06, 2013, 07:22:06 pm »
You can certainly do that in code. Use tileMap.SetTile(...) to change the tile you want and tileMap.Build() to build the updated data.
Its just that the Playmaker actions can't do this yet.