terebentina

how to swap 2 tiles?

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.