Jump to content

how to swap 2 tiles?


terebentina
 Share

Recommended Posts

I am trying to swap 2 tiles (actually I just need to move a tile up/down/left/right, in place of an empty tile).

I tried using tilemap.swap(tileA, tileB) but that only copies tileA over tileB, not the other way around too.

The "swap tiles" example says it's supposed to really swap (copy A over B and B over A) but this doesn't happen there either.

 

Is there any method that I am missing that can do this?

 

And, since I am trying to move a tile over an empty place, is there a way to tween this move?

 

Any help is greatly appreciated.

Dan

Link to comment
Share on other sites

Thanks,

 

The example is using map.putTile() but I do see putTile() is basically setting the index of the tile. I'll give it a try. 

I am thinking of first tweening the coordinates of the initial tile to move over the destination tile and then set the index on tween complete. I'll let you know how it goes.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...